toxic
Mutate keys and values in objects. Returns a new version of the object
Last updated 6 years ago by scottcorgan .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ gnpm install toxic 
SYNC missed versions from official npm registry.

toxic

Mutate keys and values in objects. Returns a new version of the object

Install

npm install toxic --save

Usage

var toxic = require('toxic');

var mutatedObject = toxic({
  key1: 'value1',
  key2: 'value2'
}, {
  mutator: function (val) {
    return val + '...'
  }
});

console.log(mutatedObject);
// OUTPUTS:
// {
//   'key1...': 'value1...',
//   'key2...': 'value2...'
// }

API

toxic(object[, options])

  • object - The object to perform mutations on.
  • options
    • mutator - Function that gets passed the current key or value. Default returns the value, as is.
    • keyMutator - Function used ot mutate the keys. Overrides mutator.
    • valueMutator - Function used ot mutate the values. Overrides mutator.

Run Tests

npm install
npm test

Current Tags

  • 1.0.1                                ...           latest (6 years ago)

2 Versions

  • 1.0.1                                ...           6 years ago
  • 1.0.0                                ...           10 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (1)
Dev Dependencies (2)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |