spicy-set

1.1.0 • Public • Published

Spicy Set 🔥

Creates Set methods for interacting with objects based on content instead of reference.

Usage

 
const SpicySet = require('spicy-set');
 
const vanillaSet = new Set();
const spicySet = SpicySet();
 
vanillaSet.add({ hello: 'world' });
spicySet.add({ hello: 'world' });
 
vanillaSet.has({ hello: 'world' }); // output: false
spicySet.hasObject({ hello: 'world' }); // output: true
 
vanillaSet.add({ hello: 'world' }); // Adds object, Set is { {hello: 'world'}, {hello: 'world'} }
spicySet.addObject({ hello: 'world' }); // Doesn't add object, Set is { {hello: 'world'} }

Scripts

  • unit tests: npm test
  • html test coverage: npm run html
  • build and view docs: npm run docs

Help

Why? JavaScript evaluates objects by reference and not value.

Readme

Keywords

none

Package Sidebar

Install

npm i spicy-set

Weekly Downloads

1

Version

1.1.0

License

MIT

Unpacked Size

8.47 kB

Total Files

8

Last publish

Collaborators

  • timholmes