get-single

0.0.2 • Public • Published

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

Readme

Keywords

Package Sidebar

Install

npm i get-single

Weekly Downloads

0

Version

0.0.2

License

MIT

Last publish

Collaborators

  • jiang-di