2018.11.12 • Published 5 years ago

@f0c1s/shallow-clone-type v2018.11.12

Weekly downloads
1
License
ISC
Repository
-
Last release
5 years ago

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 }