3.1.0 • Published 5 years ago

safesingletons v3.1.0

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

safeSingletons

Safely use singletons in NodeJS

Directions

safeSingletons is easy to use. Simply require the package in any file that needs access to a singleton.

const safeSingletons = require('safesingletons');

console.log(safeSingletons()); // Calling safesingletons without arguments returns an array of current singleton keys

safeSingletons('test', {foo : 'bar'}); // Passing a key value pair will set a singleton instance if one does not already exist for the given key

console.log(safeSingletons('test')); // Passing a known key will return a deep copy of a singleton instance. The actual singleton instance will never mutate
3.1.0

5 years ago

3.0.0

5 years ago

2.0.0

5 years ago

1.0.0

5 years ago