clone.js 286 B

1234567891011
  1. define(['./isObject', './isArray', './extend'], function (isObject, isArray, extend) {
  2. // Create a (shallow-cloned) duplicate of an object.
  3. function clone(obj) {
  4. if (!isObject(obj)) return obj;
  5. return isArray(obj) ? obj.slice() : extend({}, obj);
  6. }
  7. return clone;
  8. });