1.1.5 • Published 2 years ago

object-clone-prototype v1.1.5

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

��# object-clone-prototype


Install

> npm i object-clone-prototype

Use

const clone = require('object-clone-prototype')

const obj = {key: 'value'} // {key: {key: [ {key: ... ]}}

clone(obj) // clone(obj, obj2, obj3m ... objN)

Object.defineProperty(obj, 'new', {
        value: 'hello',
        writable: true,
        enumerable: false
})

const new_obj = obj.clone()
//or
const new_obj = clone(obj) // obj.clone() === clone(obj) but return 1 value arguments

console.log(new_obj, new_obj.new) // {key: 'value}, 'hello'

//or

const new_obj = obj.clone(false) // immutable and ignore descriptors
//or
const new_obj = clone.bind(false)(obj)

console.log(new_obj, new_obj.new) // {key: 'value}, undefined
1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago