<commit_before>'use strict';

var Syncher = require('../../syncher');

var inspectObject = require('../../inspectObject');
var extract = require('../../extract');

var struct = require('struct');

function patchUser(id, obj, callback) {
	var client = this;
	client.getUser('admin', function (err, user) {
		var password = obj.old_password && obj.new_password;
		err = err || inspectObject(obj, struct.user, {
			old_password: function (val, key) {
				return !password || val == user.password;
			}
		});
		if (err) return callback(err);
		obj = extract(obj, struct.user);
		if (password) obj.password = password;
		client.patchObject('user', id, obj, callback);
	});
}

module.exports = patchUser;<commit_msg>fix patch user id bug<commit_after>'use strict';

var Syncher = require('../../syncher');

var inspectObject = require('../../inspectObject');
var extract = require('../../extract');

var struct = require('struct');

function patchUser(id, obj, callback) {
	var client = this;
	client.getUser(id, function (err, user) {
		var password = obj.old_password && obj.<PASSWORD>;
		err = err || inspectObject(obj, struct.user, {
			old_password: function (val, key) {
				return !password || val == user.password;
			}
		});
		if (err) return callback(err);
		obj = extract(obj, struct.user);
		if (password) obj.password = password;
		client.patchObject('user', id, obj, callback);
	});
}

module.exports = patchUser;
{'fraction_non_alphanumeric': 0.17733990147783252, 'fraction_numerical': 0.0, 'mean_word_length': 4.06049822064057, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6865737', 'n_tokens_mistral': 468, 'n_tokens_neox': 438, 'n_words': 119}