hulksmash

0.0.3 • Public • Published

hulksmash Build Status

smash keys within object(s) together

browser support

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 always true. returns an object.

  • keys(object1,[objectN]):
    smashes root-level keys values together (deep copy is true) 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"
};

Package Sidebar

Install

npm i hulksmash

Weekly Downloads

1

Version

0.0.3

License

MIT

Last publish

Collaborators

  • b3ngr33ni3r