hulksmash
v0.0.3
Published
smash keys within object(s) together
Downloads
3
Maintainers
Readme
hulksmash
smash keys within object(s) together
api
hulksmash supports three methods:
(object1,[objectN]):
smashes keys together in each object, and then smashes each object together into one. returns an object.objects(object1,[objectN]):
this is a direct passthrough to justmoon/node-extend with deep copy alwaystrue
. returns an object.keys(object1,[objectN]):
smashes root-level keys values together (deep copy istrue
) in an object. If given multiple objects, will smash each objects root-level keys, and return an array of objects.
examples
smash root-level keys together in an object:
var hulksmash = require('hulksmash');
var obj = hulksmash.keys({
"one": {key: "value", override: false},
"two": {other: true, override: true}
});
// yeilds the following object
var result = {
key: "value",
other: true,
override: true
};
smash root-level keys together, in multiple objects, and then smash the objects together:
var hulksmash = require('hulksmash');
var obj = hulksmash({
"one": {key: true},
"two": {other: false}
},{
"three": {key: false},
"four": {lastly: "pie"}
});
// yeilds the following object
var result = {
key: false,
other: false,
lastly: "pie"
};