mirror of https://gitee.com/bigwinds/arangodb
Avoid _.clone
Lodash's clone is subtlely different from underscore's and breaks with ShapedJson.
This commit is contained in:
parent
de9ae5128a
commit
9ecc710491
|
@ -94,7 +94,7 @@ exports.Foxxes = function () {
|
|||
result.forEach(function(r, i) {
|
||||
// inject development flag
|
||||
if (r._key.match(/^dev:/)) {
|
||||
result[i] = _.clone(r);
|
||||
result[i] = _.extend({}, r);
|
||||
result[i].development = true;
|
||||
}
|
||||
});
|
||||
|
|
|
@ -52,7 +52,7 @@ var stringToArray = function (x) {
|
|||
if (typeof x === "string") {
|
||||
return [x];
|
||||
}
|
||||
return _.clone(x);
|
||||
return x.slice();
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -964,7 +964,7 @@ AQLGenerator.prototype.neighbors = function(vertexExample, options) {
|
|||
+ this.stack.length + ')';
|
||||
var opts;
|
||||
if (options) {
|
||||
opts = _.clone(options);
|
||||
opts = _.extend({}, options);
|
||||
} else {
|
||||
opts = {};
|
||||
}
|
||||
|
@ -2471,7 +2471,7 @@ var _renameCollection = function(oldName, newName) {
|
|||
return;
|
||||
}
|
||||
gdb.toArray().forEach(function(doc) {
|
||||
var c = _.clone(doc), i, j, changed = false;
|
||||
var c = _.extend({}, doc), i, j, changed = false;
|
||||
if (c.edgeDefinitions) {
|
||||
for (i = 0; i < c.edgeDefinitions.length; ++i) {
|
||||
var def = c.edgeDefinitions[i];
|
||||
|
|
|
@ -1106,7 +1106,7 @@ function buildRouting (dbname) {
|
|||
|
||||
while (i.hasNext()) {
|
||||
var n = i.next();
|
||||
var c = _.clone(n);
|
||||
var c = _.extend({}, n);
|
||||
|
||||
c.name = '_routing.document("' + c._key + '")';
|
||||
|
||||
|
|
|
@ -787,7 +787,7 @@ exports.Communication = function() {
|
|||
diff.missing.push(toAdd);
|
||||
return;
|
||||
}
|
||||
var compTo = _.clone(inferior[k]);
|
||||
var compTo = _.extend({}, inferior[k]);
|
||||
delete compTo.address;
|
||||
if (JSON.stringify(v) !== JSON.stringify(compTo)) {
|
||||
diff.difference[k] = {};
|
||||
|
|
|
@ -267,7 +267,7 @@ function refillCaches(dbname) {
|
|||
|
||||
while (cursor.hasNext()) {
|
||||
var config = cursor.next();
|
||||
var app = new FoxxService(_.clone(config));
|
||||
var app = new FoxxService(_.extend({}, config));
|
||||
var mount = app.mount;
|
||||
cache[mount] = app;
|
||||
routes.push(mount);
|
||||
|
|
|
@ -320,7 +320,7 @@ class FoxxService {
|
|||
var options = this.options.configuration;
|
||||
_.each(definitions, function (dfn, name) {
|
||||
var value = options[name] === undefined ? dfn.default : options[name];
|
||||
config[name] = simple ? value : _.extend(_.clone(dfn), {
|
||||
config[name] = simple ? value : _.extend({}, dfn, {
|
||||
title: getReadableName(name),
|
||||
current: value
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue