3.0.0 • Published 4 years ago

define-lazy-prop v3.0.0

Weekly downloads
220
License
MIT
Repository
github
Last release
4 years ago

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.

Related

opencuc-gafcomponennentteasy-select-rnreact-native-shekhar-bridge-testcogoportutilslevibestliblevibestlib2levilibtest19levilibtest24levilibtest25levilibtest26levilibtest27levilibtest28levilibtest29@oiti/documentoscopy-react-nativequoc-testunblock-block-save-variablescclibyarntest@saaspe/componentshyperpass-sdkluminos-ui-coresklif-ui-kitsklif-api@everything-registry/sub-chunk-1461jawwy-sdkjawwy_gamification_releasereact-native-sphereuisphereuijawwy_libraryreact-native-credit-card-pkgp149-tablesklif-uireact-native-jawwy_samplegriffin-ui-library@wacoco/ytaman-baca-masyarakattest-library-123test-haptik-libwebdatabasetest1webdatabasetest10webdesa-laravel-final-releasewebpack_component_fundwifi_configuration_packagern-currency-formatterrn-counter-demorn_unique_device_idshainashirin-common-packagesf-web-componentsscout-chatbot-widgetresponsis-gantt-task-reactreactnativelyreactofy-css-libraryrn-check-btnteapackage-tatespoorman297stories-fsreact-native-wtfreact-native-version-appreact-native-withframework-checksedanbosoktesting-storybooktestweblibapitest-zeo-collectvision-camera-plugin-face-detectorvision-camera-base64-resizedvantiq-react@ahmed-hairon/sharingjawwy_library_newjawy_library_v1gamification-jawwy-libraryframework_test_library_sixdee_new_jawwynextjs-storiestest_lib_module_aaranci-reactquickcapture_react_nativesushi-sdk-ftmrn-agora-ios-mmtva-teleport-toolzzzxxxyyy321123mkcp-solarpunklanj-test-componentsjesh-calculationjrennsoh88-react-native-scroll-indicatorlszyydsimage-carousel-juan-correa-50instance-uilit-patient-cardliusizhedemomicroend-componentmj4d-excalidraw-originallevilibtest15levilibtest16levilibtest17levilibtest18levilibtest21levilibtest22levilibtest23levimultiplatform10levimultiplatformtest
3.0.0

4 years ago

2.0.0

6 years ago

1.0.0

8 years ago