obj-spread
v1.0.23
Published
My very own functions for array manipulation, called `arra`
Downloads
35
Readme
A simple, but powerful way to extend classes with other classes. You can even extend built-in classes, like Array
or String
Installation
npm i obj-spread -S
Usage
For example, you want to move all static functions from class Foo
to internal class String
. All you need to do is
to create an instance of ObjSpread:
new ObjSpread(Foo, String, s=>String(s));
Here, the last argument will convert the value to an actual String
class.
For example, if you want to spread to Array
, you would do the following:
new ObjSpread(Foo, Array, a=>[].concat(a));
In case if you don't need to convert anything, just do a=>a
.