No Description

clone.js 290B

123456789
  1. import isObject from './isObject.js';
  2. import isArray from './isArray.js';
  3. import extend from './extend.js';
  4. // Create a (shallow-cloned) duplicate of an object.
  5. export default function clone(obj) {
  6. if (!isObject(obj)) return obj;
  7. return isArray(obj) ? obj.slice() : extend({}, obj);
  8. }