@f0c1s/shallow-clone-type
v2018.11.12
Published
Clones an object type (shallow) and all the values are set to null.
Downloads
2
Readme
Clones an object type (shallow) and all the values are set to null.
Installation npm i @f0c1s/shallow-clone-type
Usage const sct = require('@f0c1s/shallow-clone-type') const o = { name: '', age: '', sex: '', address: { /* complex object */ }} sct(o)
Sample var triangle = {a: 1, b: 2, c: 3};
function ColoredTriangle() {
this.color = 'red';
}
ColoredTriangle.prototype = triangle;
var obj = new ColoredTriangle();
sct(obj)
// { color: null, a: null, b: null, c: null }
// If you use -strict version of this module, @f0c1s/shallow-clone-type-strict;
// then you will get
// { color: null }