memorizer

1.0.1 • Public • Published

memorizer

NPM version build status Test coverage

Memoize a property with a lazy callback. Great for creating internal promises or computationally expensive rproperties.

const memoize = require('memorizer')
 
function Constructor () {
  this.promise.then(val => {
    // val === true
  })
}
 
memoize(Constructor.prototype, 'promise', function () {
  return new Promise(true)
})

API

memoize(object: Object, property: String, getter: Function)

The getter's return value will be memoized.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.1
    7,773
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.1
    7,773
  • 1.0.0
    1

Package Sidebar

Install

npm i memorizer

Weekly Downloads

2,037

Version

1.0.1

License

MIT

Last publish

Collaborators

  • jongleberry
  • jonathanong