$ gnpm install memorizer
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)
})
The getter
's return value will be memoized.
Copyright 2013 - present © cnpmjs.org | Home |