setup-maven-cached/node_modules/underscore/cjs/clone.js

12 lines
309 B
JavaScript
Raw Normal View History

2022-06-28 16:39:30 +08:00
var isObject = require('./isObject.js');
var isArray = require('./isArray.js');
var extend = require('./extend.js');
// Create a (shallow-cloned) duplicate of an object.
function clone(obj) {
if (!isObject(obj)) return obj;
return isArray(obj) ? obj.slice() : extend({}, obj);
}
module.exports = clone;