Sha256: df7e5ea20c711b0809519c6dd1203460017f4ca2f232748a0679e3af36182557
Contents?: true
Size: 524 Bytes
Versions: 10
Compression:
Stored size: 524 Bytes
Contents
/** * The MIT License (MIT) * Copyright (c) 2017-present Dmitry Soshnikov <dmitry.soshnikov@gmail.com> */ 'use strict'; /** * Performs a deep copy of an simple object. * Only handles scalar values, arrays and objects. * * @param obj Object */ 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; };
Version data entries
10 entries across 10 versions & 3 rubygems