1.0.0 • Published 8 years ago

newtility v1.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
8 years ago

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
1.0.0

8 years ago