Big update!Introducing GitHub Bot Commands. Learn more
Socket
Log inDemoInstall

define-lazy-prop

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Issues
File Explorer

Advanced tools

define-lazy-prop

Define a lazily evaluated property on an object

    3.0.0latest
    Github

Version published
Maintainers
1
Weekly downloads
13,783,911
increased by9.77%

Weekly downloads

Readme

Source

define-lazy-prop

Define a lazily evaluated property on an object

Useful when the value of a property is expensive to generate, so you want to delay the computation until the property is needed. For example, improving startup performance by deferring nonessential operations.

Install

$ npm install define-lazy-prop

Usage

import defineLazyProperty from 'define-lazy-prop'; const unicorn = { // … }; defineLazyProperty(unicorn, 'rainbow', () => expensiveComputation()); app.on('user-action', () => { doSomething(unicorn.rainbow); });

API

defineLazyProperty(object, propertyName, valueGetter)

object

Type: object

Object to add the property to.

propertyName

Type: string

Name of the property to add.

valueGetter

Type: Function

Called the first time propertyName is accessed. Expected to return a value.

  • lazy-value - Create a lazily evaluated value
  • import-lazy - Import a module lazily
  • p-lazy - Create a lazy promise

Keywords

FAQs

What is define-lazy-prop?

Define a lazily evaluated property on an object

Is define-lazy-prop popular?

The npm package define-lazy-prop receives a total of 13,219,467 weekly downloads. As such, define-lazy-prop popularity was classified as popular.

Is define-lazy-prop well maintained?

We found that define-lazy-prop demonstrated a not healthy version release cadence and project activity because the last version was released a year ago.It has 1 open source maintainer collaborating on the project.

Last updated on 14 Apr 2021

Did you know?

Socket installs a Github app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install Socket
Socket[email protected]

Product

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc