1.0.1 • Published 5 years ago

extend-objects v1.0.1

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

extend-objects

A JavaScript library adds "extend" functionality and a little more

How to install it?

If you use NPM package manager

npm install extend-objects --save

or

If you use YARN package manage

yarn add extend-objects

How to use it?

Firstly, when you installed it, you should include it:

require('extend-objects')

Then, .extend method was added to Object.prototype, so you can you it like here:

someObject1.extend(someObject2)
// it returns a result, so you can assign it
result = someObject1.extend(someObject2)

// it's similar to
Object.assign(someObject1, someObject2)
// it returns a result, so you can assign it
result = Object.assign(someObject1, someObject2)

or even extend multiple objects a time

result = someObject1.extend(someObject2, someObject3/*, etc...*/)
// or
result = someObject1.extend(someObject2).extend(someObject3) // etc

// it's similar to
result = Object.assign(someObject1, someObject2, someObject3/*, etc...*/)

or, if you also want to use standalone function, like jQuery.extend, you can also assign require's value to a variable

let extend = require('extend-objects')

So, you can use it like this:

extend(someObject1, someObject2, someObject3)
// It returns result, so you can assign it too
let result = extend(someObject1, someObject2, someObject3)

Thanks for your attention, hope my simple library is useful for you.

If you have suggestions to improve the lib or this README (i am not good at English), contact me: at Telegram (@Wynell), at Discord (hs#5588), at VK (@p3trukh1n)

1.0.1

5 years ago

1.0.0

5 years ago