lazy-value
TypeScript icon, indicating that this package has built-in type declarations

3.0.0 • Public • Published

lazy-value

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.

Install

$ npm install lazy-value

Usage

import lazyValue from 'lazy-value';

const value = lazyValue(() => expensiveComputation());

app.on('user-action', () => {
	doSomething(value());
});

API

lazyValue(fn)

fn

Type: Function

Expected to return a value.

Related

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 3.0.0
    255
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 3.0.0
    255
  • 2.0.0
    144
  • 1.0.0
    15

Package Sidebar

Install

npm i lazy-value

Weekly Downloads

414

Version

3.0.0

License

MIT

Unpacked Size

3.33 kB

Total Files

5

Last publish

Collaborators

  • sindresorhus