Keine Beschreibung
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
dienianindya 65435fcb07 update sore vor 1 Jahr
..
LICENSE update sore vor 1 Jahr
README.md update sore vor 1 Jahr
index.js update sore vor 1 Jahr
package.json update sore vor 1 Jahr
test.js update sore vor 1 Jahr

README.md

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