1.0.8 • Published 2 years ago

smart-assign v1.0.8

Weekly downloads
2
License
ISC
Repository
github
Last release
2 years ago

SmartAssign

a smarter version of Object.assign. deep assign when Object.assign is defined, otherwise, it will deep copy every property iteratively.

install

npm install --save smart-assign

usage example

import smartAssign from '../lib/index';  

let data = 'data';  

smartAssign(  
    {},  
    {  
        a: {  
            a1: 'a1',  
            a2: () => {  
                return 'a2';  
            },  
        },  
        b: {  
            b1: function () {  
                console.log('b1 enter.')  
            },  
            b2: function () {  
                return data;  
            },  
        },  
    }  
); 

tips

Objects without prototype can not be copied, can not be assigned, thus it will never change as the first parameter, and never be copied as other parameters

1.0.9

8 months ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

7 years ago

1.0.0

7 years ago