newtility
v1.0.0
Published
Utility for generic shallow copies and instances creation.
Downloads
3
Readme
newtility
Utility for generic shallow copies and instances creation.
Available in npm
through npm install newtility
.
node example
var New = require('newtility');
var object = New(Constructor[, args])
Create an instance of Constructor
using the optional Array object args
as list of arguments.
var ott = New(Array, [1, 2, 3]);
var ui32 = New(Uint32Array, [ [4, 5, 6] ]);
var copy = New(object);
Create a shallow copy of a generic object.
var a = [1, 2, 3];
var b = New(a);
a !== b; // true
a.join() === b.join(); // true