clone icon indicating copy to clipboard operation
clone copied to clipboard

deeply clone arbitrary objects in javascript

Results 29 clone issues
Sort by recently updated
recently updated
newest added

Consider the following example: var o = {}; Object.defineProperty(o, 'foo', {enumerable:true, writable:false, value:'f'}); var o2 = clone(o); console.log(Object.getOwnPropertyDescriptor(o2, 'foo')); The property descriptor on the copied object specifies the property as...

Just a thought, support for ES6 modules could be added by adding one line to the last `if` block of `clone.js` like so: if (typeof module === 'object' && module.exports)...

When I try to clone an object that has getter methods defined, this lib seems to be calling those getters rather than coping the function :S

``` require('clone')(new Float32Array([10,11])) Float32Array { '0': 10, '1': 11 } // actual Float32Array [ 10, 11 ] // expected ``` Similar to #1, but for typed arrays.

``` javascript var clone = require('clone'); var obj = {} var obj2 = { a: obj, b: obj }; var noFlagClone = clone(obj2); console.log( noFlagClone.a === noFlagClone.b ); //true var...

``` "use strict"; var clone = require("clone"); function Foo() {} Foo.prototype.prop = 1; var a = new Foo; a.prop = 2; var b = clone(a); console.log(a, b); ``` Hello, please...

...as a good general practices. Dose not clone same stuff. like it can't clone Promises for instance. But can solve the job for some common task.

The following tests should not fail: ```javascript it('should clone a getter', () => { const input = { a: 2, get foo() { return this.a * 2 } } let...

Hi !! Do you have an email address where I can send a security vulnerability? Regards.