lazy-value
Create a lazily evaluated value
Last updated 5 years ago by sindresorhus .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install lazy-value 
SYNC missed versions from official npm registry.

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

Current Tags

  • 3.0.0                                ...           latest (5 years ago)

3 Versions

  • 3.0.0                                ...           5 years ago
  • 2.0.0                                ...           7 years ago
  • 1.0.0                                ...           9 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (0)
None
Dev Dependencies (3)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |