No Description

clone.js 309B

1234567891011
  1. var isObject = require('./isObject.js');
  2. var isArray = require('./isArray.js');
  3. var extend = require('./extend.js');
  4. // Create a (shallow-cloned) duplicate of an object.
  5. function clone(obj) {
  6. if (!isObject(obj)) return obj;
  7. return isArray(obj) ? obj.slice() : extend({}, obj);
  8. }
  9. module.exports = clone;