Create a lazily evaluated value
Useful when a value is expensive to generate, so you want to delay the computation until the value is needed. For example, improving startup performance by deferring nonessential operations.
$ npm install --save lazy-value
const lazyValue = require('lazy-value');
const val = lazyValue(() => expensiveComputation());
app.on('user-action', () => {
doSomething(val());
});
Type: Function
Expected to return a value.
- define-lazy-prop - Define a lazily evaluated property on an object
- import-lazy - Import a module lazily
- p-lazy - Create a lazy promise
MIT © Sindre Sorhus