Socket
Socket
Sign inDemoInstall

toxic

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

toxic

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


Version published
Weekly downloads
449K
increased by6.67%
Maintainers
1
Weekly downloads
 
Created
Source

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

Keywords

FAQs

Package last updated on 15 Jun 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc