1234567891011121314151617181920212223242526272829 |
- 'use strict';
- module.exports = function clone(obj) {
- if (obj === null || typeof obj !== 'object') {
- return obj;
- }
- var res = void 0;
- if (Array.isArray(obj)) {
- res = [];
- } else {
- res = {};
- }
- for (var i in obj) {
- res[i] = clone(obj[i]);
- }
- return res;
- };
|