single-space

1.0.0 • Public • Published

single-space

A module which provides a simple way for ensuring singleton in node.

npm version Build Status Coverage Status

Code copied and modified gently from

https://derickbailey.com/2016/03/09/creating-a-true-singleton-in-node-js-with-es6-symbols/

Thanks to this developer.

Ussage

const SingleSpace = require('single-space');
 
module.exports = SingleSpace('module.my.namespace.example', () => {
    function Example(options) {
        if (!(this instanceof Example)) {
            return new Example(options);
        }
 
        this.options = options;
    }
 
    Example.prototype.echo = function echo(sound) {
        return sound;
    }
 
    return Example;
});

Readme

Keywords

Package Sidebar

Install

npm i single-space

Weekly Downloads

4

Version

1.0.0

License

ISC

Last publish

Collaborators

  • codemedic42