{"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":{"integrity":"sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg==","shasum":"dbb19adfb746d7fc6d734a06b72f4a00d021255f","tarball":"http://registry-npm.ywwl.com/define-lazy-prop/download/define-lazy-prop-3.0.0.tgz","fileCount":5,"unpackedSize":4415,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgdp+dCRA9TVsSAnZWagAAtdIP/2XG9kff8vkvo9QfDrsu\n+Jen7qpf9DQZh6avmkR5qITSRAFgvO+Ndxxhj/fzXgmqmiL6TtB/pMmdbaMk\n17OY88dlkaTPnbimTmL55KBKge1h1E3QdvM/qSUm/XjgTZr39+/ITqnJT0Dg\ny1THjjauTBT4mpoFfNxz4SK4XTEToB6vJBPeUrsFYbKG7wDcVpMuzHFwf8Uj\nGIpnw0Hfvq94hkXw58CWonb8Y4oHE/RkjxcD1I6b3F8sH3h42wNIq2Pw2fZb\nJC1g+I/lM0tqWVbHWgnyoDeuiwGp5mQ/WH8EALMCzGzd8C7h/EGZFBkn0QBG\nfmLoCtSP1JaxM38R9/0EZAltUlAdCZ38dPZ7iDGGCPoBBW8wVQVd+nqJ86/R\nZWqStt66MS2EP51QVWwKpLfcz4/n4zv3fhKMs2fqpivQyYZCO18o9Hc2A2H3\nWEzgbM4gUsZiNueVhb+JrqxZuSItbDaPpNQ9XLRKeAHUU2Je5q1SIZG/rmXB\nw7Vdbc9dD2VgjaSDF+ETmNid+LcgbFZQv6Z60KCTUeBBheJS3ZTjhe68DIFV\nzAxOPGXoQcpOOK+ypI4TOby9FbUVQsmMVM7Xg2obBgntgAlpW4QQ4P7cZwRH\nqlBV2W4QT1f4Fb+3pWPcNGLB8pPJBlycT1lHdPWfSp8hkElc00hR6J2qYKCU\nyHEq\r\n=zv6n\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFNVJiBrxBbTbwPqTinEKkzW1C0ttfJ0SqZs7d/wLnMTAiB91INsrjYQT7qYS4Z7AfTAm/87zUQfz/djVacxhN7tjA=="}],"size":2063,"noattachment":false,"key":"/define-lazy-prop/-/define-lazy-prop-3.0.0.tgz"},"directories":{},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/define-lazy-prop_3.0.0_1618386845533_0.6683468646287365"},"_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","publish_time":1618386845644,"_cnpm_publish_time":1618386845644,"dist-tags":{"latest":"3.0.0"}}