Skip to content

Commit

Permalink
Don't modify passed in apiConf
Browse files Browse the repository at this point in the history
 * It prevents reuse of parsoidOptions, relevant to an upcoming patch.

Change-Id: Ic27f1e0feba0ae5c3e172d70f0b4c2d6ec079ca2
  • Loading branch information
arlolra committed May 25, 2017
1 parent 5e394a9 commit fd8defe
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/config/ParsoidConfig.js
Expand Up @@ -458,11 +458,14 @@ ParsoidConfig.prototype.setMwApi = function(apiConf) {
} else if (typeof arguments[1] === 'object') {
// Note that `apiConf` is aliased to `arguments[0]`.
prefix = arguments[0];
apiConf = arguments[1]; // overwrites `arguments[0]`
apiConf = Object.assign({}, arguments[1]); // overwrites `arguments[0]`
apiConf.prefix = prefix;
} else {
apiConf = { uri: arguments[0] };
}
} else {
console.assert(typeof apiConf === 'object');
apiConf = Object.assign({}, apiConf); // Don't modify the passed in object
}
console.assert(apiConf.uri, "Action API uri is mandatory.");
if (!apiConf.prefix) {
Expand Down

0 comments on commit fd8defe

Please sign in to comment.