{"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":{"integrity":"sha512-Ds09qNh8yw3khSjiJjiUInaGX9xlqZDY7JVryGxdxV7NPeuqQfplOpQ66yJFZut3jLa5zOwkXw1g9EI2uKh4Og==","shasum":"3f7ae421129bcaaac9bc74905c98a0009ec9ee7f","tarball":"http://registry-npm.ywwl.com/define-lazy-prop/download/define-lazy-prop-2.0.0.tgz","fileCount":5,"unpackedSize":4446,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcrataCRA9TVsSAnZWagAA5x4P/2DGU+J6DKSX2+75RZVi\nu4YzMpoTg9aykAny7ezprTxRwM5W+PxTUcjJ+en3Rxzixze3yyIBYt/v+v2o\n1ZOF9d7bMxtXKGIS1VZhfmJobHqgWFOwsAjG3tyEn8cpXX8aCS33mDdXAwKx\ntJPWd/DHzK39x++qhT/rkvfp6u67W62Hnu2QQ9CWHmtigRlmNyhD5Z6/iHEc\nBHooxBJu3NOCha7DNHj/kjNvWdjAHBYSFw/YMfDtj2Esi8Om2X4m7QE1fFPq\nj09vCu+OUW4zyOV8CuSQtRpZRI5LPe8r+X9sClFifcN8B6uIvSkCk8r3zEf9\nl7aLdOZPPC2oxgxNxaBM03kgWhrb6TNXC8jPFIi8E01PYBjlRP564+CATx+I\nR6DABaIqj2Yx5xCACmxm1jBOBTPbnneoe6bErwUGH3qj6GIDnr/WiHcxbR/v\ngRHDMVzhelD/FnfXUMc5r9ykPx8SxSMGybGc/Fbx1KFM6kVS4pk7+SdjD5PG\nmD/Y2zVrtvnlRr64AwAeP0PPwQqmYpisxZnMutMYesNmPVLxaWLSi3C8bDdP\nLJ26i9cD5CIZ7I6qO1VgRx6SwktDshCZChzEDLx7jb+FBvtrclKbdlg0p6eX\nHv5hGrz7LBkxmiZGj0ktfmcnVUUa+fdlSQcl3a6S4lPWHEVrUjwr0qdZ292d\n5jvJ\r\n=7R5G\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHc0X8lUtwI7OzFsJjcNpBfKd/rVaQ6rKLf43+F3xDLTAiAmJ4ulKJ8H3Kfj5ThtRnWhw9q1EVfwTh+IwqAJQBbZTg=="}],"size":2117,"noattachment":false,"key":"/define-lazy-prop/-/define-lazy-prop-2.0.0.tgz"},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/define-lazy-prop_2.0.0_1554885465463_0.30276632388262414"},"_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":1554885465646,"_cnpm_publish_time":1554885465646,"dist-tags":{"latest":"3.0.0"}}