0.0.2 • Published 8 years ago

get-single v0.0.2

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

get-single Build Status

Singleton Pattern the JavaScript way

Install

$ npm install --save get-single

Usage

const getSingle = require('get-single')

function fn(name) {
  return {name: name}
}

const singleFn = getSingle(fn)

let obj1 = singleFn('obj1')
let obj2 = singleFn('obj2')
let obj3 = singleFn('obj3')

console.log(obj1 === obj2) // true
console.log(obj2 === obj3) // true

API

getSingle(fn)

fn

Type: function

License

MIT © JIANG Di