@schlandower/objectpush
v2.0.0
Published
Push that operates with Objects instead of arrays, used for joining objects including renaming duplicate keys (if the first parameter is true, default is false), by appending four underscores ( ____ ) and a number to the end of the key. Thereby making it
Downloads
2
Maintainers
Readme
objectpush
Push for objects instead of arrays. The maximum number of objects to be merged at one time is 5.
Only the calling object and the second parameter are needed as a minimum.
Usage: require('@schlandower/objectpush'); var obj1 = {"key1":"val1", "key2":"val2", "key3":"val3"};
var obj2 = {"newkey1":"nval1", "key2":"nval2", "newkey3":"nval3"};
var obj3 = {"key1":"gibberish", "nk1":"nval6", "key8":"gfsrthjih", "newkey3":"fluffy"};
var obj4 = {"10":"fuzzy", "strange":"dghgtrdgff44ytrgf", "newkey3":"sggdthfetgsd"};
var obj5 = {"key1":"other gibberish", "nk1":"oddball", "key18":"plop dunk", "sdrk":"very odd"};
Retain all values: var pushResult = obj1.push(true, obj2, obj3, obj4, obj5);
Overwrite previous values: var pushResult = obj1.push(, obj2, obj3, obj4, obj5);
OR
var pushResult = obj1.push('', obj2, obj3, obj4, obj5);
Which ever works for your nodejs installation, some behave oddly.