{"_id":"define-lazy-prop","_rev":"18803","name":"define-lazy-prop","description":"Define a lazily evaluated property on an object","dist-tags":{"latest":"3.0.0"},"maintainers":[{"name":"sindresorhus","email":""}],"time":{"modified":"2021-06-03T09:59:44.000Z","created":"2017-01-15T14:18:11.896Z","3.0.0":"2021-04-14T07:54:05.644Z","2.0.0":"2019-04-10T08:37:45.646Z","1.0.0":"2017-01-15T14:18:11.896Z"},"users":{},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"repository":{"type":"git","url":"git+https://github.com/sindresorhus/define-lazy-prop.git"},"versions":{"3.0.0":{"name":"define-lazy-prop","version":"3.0.0","description":"Define a lazily evaluated property on an object","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/define-lazy-prop.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"type":"module","exports":"./index.js","engines":{"node":">=12"},"scripts":{"test":"xo && ava && tsd"},"keywords":["lazy","property","properties","prop","define","object","value","lazily","laziness","evaluation","eval","execute","getter","function","fn","memoize","cache","defer","deferred"],"devDependencies":{"ava":"^3.15.0","tsd":"^0.14.0","xo":"^0.38.2"},"gitHead":"038c2e8088b23e81100e34e7f38d1690c631157c","bugs":{"url":"https://github.com/sindresorhus/define-lazy-prop/issues"},"homepage":"https://github.com/sindresorhus/define-lazy-prop#readme","_id":"define-lazy-prop@3.0.0","_nodeVersion":"15.12.0","_npmVersion":"6.14.10","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"dbb19adfb746d7fc6d734a06b72f4a00d021255f","size":2063,"noattachment":false,"key":"/define-lazy-prop/-/define-lazy-prop-3.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/define-lazy-prop/download/define-lazy-prop-3.0.0.tgz"},"directories":{},"maintainers":[{"name":"sindresorhus","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/define-lazy-prop_3.0.0_1618386845533_0.6683468646287365"},"_hasShrinkwrap":false,"publish_time":1618386845644,"_cnpm_publish_time":1618386845644},"2.0.0":{"name":"define-lazy-prop","version":"2.0.0","description":"Define a lazily evaluated property on an object","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/define-lazy-prop.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=8"},"scripts":{"test":"xo && ava && tsd"},"keywords":["lazy","property","properties","prop","define","object","value","lazily","laziness","evaluation","eval","execute","getter","function","fn","memoize","cache","defer","deferred"],"devDependencies":{"ava":"^1.4.1","tsd":"^0.7.2","xo":"^0.24.0"},"gitHead":"32b6a49111ccf65e2d4a07c0d8e6d2c9bef78c90","bugs":{"url":"https://github.com/sindresorhus/define-lazy-prop/issues"},"homepage":"https://github.com/sindresorhus/define-lazy-prop#readme","_id":"define-lazy-prop@2.0.0","_npmVersion":"6.4.1","_nodeVersion":"10.15.1","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"3f7ae421129bcaaac9bc74905c98a0009ec9ee7f","size":2117,"noattachment":false,"key":"/define-lazy-prop/-/define-lazy-prop-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/define-lazy-prop/download/define-lazy-prop-2.0.0.tgz"},"maintainers":[{"name":"sindresorhus","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/define-lazy-prop_2.0.0_1554885465463_0.30276632388262414"},"_hasShrinkwrap":false,"publish_time":1554885465646,"_cnpm_publish_time":1554885465646},"1.0.0":{"name":"define-lazy-prop","version":"1.0.0","description":"Define a lazily evaluated property on an object","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/define-lazy-prop.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=4"},"scripts":{"test":"xo && ava"},"files":["index.js"],"keywords":["lazy","property","properties","prop","define","object","obj","value","lazily","laziness","val","evaluation","eval","execute","getter","function","fn","memoize","cache","defer","deferred"],"devDependencies":{"ava":"*","xo":"*"},"gitHead":"8077e201f5e9a269ab686873bca03b0a41719b26","bugs":{"url":"https://github.com/sindresorhus/define-lazy-prop/issues"},"homepage":"https://github.com/sindresorhus/define-lazy-prop#readme","_id":"define-lazy-prop@1.0.0","_shasum":"c9f83eabd8f2ce19e916f59ca68c06a2d175f210","_from":".","_npmVersion":"3.10.8","_nodeVersion":"6.9.1","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"c9f83eabd8f2ce19e916f59ca68c06a2d175f210","size":1939,"noattachment":false,"key":"/define-lazy-prop/-/define-lazy-prop-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/define-lazy-prop/download/define-lazy-prop-1.0.0.tgz"},"maintainers":[{"name":"sindresorhus","email":""}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/define-lazy-prop-1.0.0.tgz_1484489889934_0.29690037947148085"},"directories":{},"publish_time":1484489891896,"_cnpm_publish_time":1484489891896,"_hasShrinkwrap":false}},"readme":"# define-lazy-prop\n\n> Define a [lazily evaluated](https://en.wikipedia.org/wiki/Lazy_evaluation) property on an object\n\nUseful 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.\n\n## Install\n\n```\n$ npm install define-lazy-prop\n```\n\n## Usage\n\n```js\nimport defineLazyProperty from 'define-lazy-prop';\n\nconst unicorn = {\n\t// …\n};\n\ndefineLazyProperty(unicorn, 'rainbow', () => expensiveComputation());\n\napp.on('user-action', () => {\n\tdoSomething(unicorn.rainbow);\n});\n```\n\n## API\n\n### defineLazyProperty(object, propertyName, valueGetter)\n\n#### object\n\nType: `object`\n\nObject to add the property to.\n\n#### propertyName\n\nType: `string`\n\nName of the property to add.\n\n#### valueGetter\n\nType: `Function`\n\nCalled the first time `propertyName` is accessed. Expected to return a value.\n\n## Related\n\n- [lazy-value](https://github.com/sindresorhus/lazy-value) - Create a lazily evaluated value\n- [import-lazy](https://github.com/sindresorhus/import-lazy) - Import a module lazily\n- [p-lazy](https://github.com/sindresorhus/p-lazy) - Create a lazy promise\n","_attachments":{},"homepage":"https://github.com/sindresorhus/define-lazy-prop#readme","bugs":{"url":"https://github.com/sindresorhus/define-lazy-prop/issues"},"license":"MIT"}