UNPKG

@antv/util

Version:

> AntV 底层依赖的工具库,不建议在自己业务中使用。

35 lines 940 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var tslib_1 = require("tslib"); var is_array_1 = tslib_1.__importDefault(require("./is-array")); var clone = function (obj) { if (typeof obj !== 'object' || obj === null) { return obj; } var rst; if ((0, is_array_1.default)(obj)) { rst = []; for (var i = 0, l = obj.length; i < l; i++) { if (typeof obj[i] === 'object' && obj[i] != null) { rst[i] = clone(obj[i]); } else { rst[i] = obj[i]; } } } else { rst = {}; for (var k in obj) { if (typeof obj[k] === 'object' && obj[k] != null) { rst[k] = clone(obj[k]); } else { rst[k] = obj[k]; } } } return rst; }; exports.default = clone; //# sourceMappingURL=clone.js.map