1.0.23 • Published 3 years ago

obj-spread v1.0.23

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

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.

1.0.23

3 years ago

1.0.19

3 years ago

1.0.17

3 years ago

0.0.12

3 years ago