extend.js 518 B

1234567891011121314151617181920
  1. import {$set} from './modify';
  2. const _extends = Object.assign || function (a) {
  3. for (let b, c = 1; c < arguments.length; c++) {
  4. for (let d in b = arguments[c], b) {
  5. Object.prototype.hasOwnProperty.call(b, d) && ($set(a, d, b[d]));
  6. }
  7. }
  8. return a;
  9. }
  10. export default function extend() {
  11. return _extends.apply(this, arguments);
  12. }
  13. export function copy(obj) {
  14. if (typeof obj !== 'object' || obj === null) return obj;
  15. return obj instanceof Array ? [...obj] : {...obj};
  16. }