{"_id":"lazy-req","_rev":"98759","name":"lazy-req","description":"Require modules lazily","dist-tags":{"latest":"3.0.0"},"maintainers":[{"name":"sindresorhus","email":""}],"time":{"modified":"2021-06-03T10:33:21.000Z","created":"2014-08-16T16:01:11.014Z","3.0.0":"2018-11-08T08:14:11.222Z","2.0.0":"2017-01-17T09:44:36.932Z","1.1.0":"2015-08-10T08:54:46.271Z","1.0.0":"2014-08-16T16:01:11.014Z"},"users":{"danielbayley":true},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"repository":{"type":"git","url":"git+https://github.com/sindresorhus/lazy-req.git"},"versions":{"3.0.0":{"name":"lazy-req","version":"3.0.0","description":"Require modules lazily","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/lazy-req.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"contributors":[{"name":"Jorge Bucaran","email":"jbucaran@me.com"}],"engines":{"node":">=4"},"scripts":{"test":"xo && ava"},"keywords":["require","load","module","modules","lazy","lazily","defer","deferred","proxy","proxies"],"devDependencies":{"ava":"*","xo":"*"},"gitHead":"498395dd746a0ecfd6aeb785ecb93c593d5a680f","bugs":{"url":"https://github.com/sindresorhus/lazy-req/issues"},"homepage":"https://github.com/sindresorhus/lazy-req#readme","_id":"lazy-req@3.0.0","_npmVersion":"6.4.1","_nodeVersion":"8.12.0","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"1c686fd0fa5907cbdab81909657f082f3a0d7e9d","size":2251,"noattachment":false,"key":"/lazy-req/-/lazy-req-3.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/lazy-req/download/lazy-req-3.0.0.tgz"},"maintainers":[{"name":"sindresorhus","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/lazy-req_3.0.0_1541664851135_0.004594258872200996"},"_hasShrinkwrap":false,"publish_time":1541664851222,"_cnpm_publish_time":1541664851222,"deprecated":"Renamed to `import-lazy`."},"2.0.0":{"name":"lazy-req","version":"2.0.0","description":"Require modules lazily","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/lazy-req.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"contributors":[{"name":"Jorge Bucaran","email":"jbucaran@me.com"}],"engines":{"node":">=4"},"scripts":{"test":"xo && ava"},"files":["index.js"],"keywords":["require","load","module","modules","lazy","lazily","defer","deferred","proxy","proxies"],"devDependencies":{"ava":"*","xo":"*"},"gitHead":"498395dd746a0ecfd6aeb785ecb93c593d5a680f","bugs":{"url":"https://github.com/sindresorhus/lazy-req/issues"},"homepage":"https://github.com/sindresorhus/lazy-req#readme","_id":"lazy-req@2.0.0","_shasum":"c9450a363ecdda2e6f0c70132ad4f37f8f06f2b4","_from":".","_npmVersion":"2.15.11","_nodeVersion":"4.6.2","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"c9450a363ecdda2e6f0c70132ad4f37f8f06f2b4","size":2272,"noattachment":false,"key":"/lazy-req/-/lazy-req-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/lazy-req/download/lazy-req-2.0.0.tgz"},"maintainers":[{"name":"sindresorhus","email":""}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/lazy-req-2.0.0.tgz_1484646276710_0.28619852592237294"},"directories":{},"publish_time":1484646276932,"_cnpm_publish_time":1484646276932,"_hasShrinkwrap":false},"1.1.0":{"name":"lazy-req","version":"1.1.0","description":"Require modules lazily","license":"MIT","repository":{"type":"git","url":"https://github.com/sindresorhus/lazy-req"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"http://sindresorhus.com"},"contributors":[{"name":"Jorge Bucaran","email":"jbucaran@me.com"}],"engines":{"node":">=0.10.0"},"scripts":{"test":"xo && node test.js"},"files":["index.js"],"keywords":["require","load","module","modules","lazy","lazily","defer","deferred"],"devDependencies":{"ava":"0.0.4","xo":"*"},"gitHead":"9ac4b63005b62a04ef4d237b046d014f94e8aee5","bugs":{"url":"https://github.com/sindresorhus/lazy-req/issues"},"homepage":"https://github.com/sindresorhus/lazy-req","_id":"lazy-req@1.1.0","_shasum":"bdaebead30f8d824039ce0ce149d4daa07ba1fac","_from":".","_npmVersion":"2.11.2","_nodeVersion":"0.12.5","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"bdaebead30f8d824039ce0ce149d4daa07ba1fac","size":1931,"noattachment":false,"key":"/lazy-req/-/lazy-req-1.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/lazy-req/download/lazy-req-1.1.0.tgz"},"maintainers":[{"name":"sindresorhus","email":""}],"directories":{},"publish_time":1439196886271,"_cnpm_publish_time":1439196886271,"_hasShrinkwrap":false},"1.0.0":{"name":"lazy-req","version":"1.0.0","description":"Require modules lazily","license":"MIT","repository":{"type":"git","url":"git://github.com/sindresorhus/lazy-req"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"http://sindresorhus.com"},"engines":{"node":">=0.10.0"},"scripts":{"test":"node test.js"},"files":["index.js"],"keywords":["require","load","module","modules","lazy","lazily","defer","deferred"],"devDependencies":{"ava":"0.0.3"},"gitHead":"fa7b4ade760b39b9ed01daec882269b498f4dd0e","bugs":{"url":"https://github.com/sindresorhus/lazy-req/issues"},"homepage":"https://github.com/sindresorhus/lazy-req","_id":"lazy-req@1.0.0","_shasum":"fc9a9050bd005ee7b42a9a497d075884e4a470f0","_from":".","_npmVersion":"1.4.14","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"maintainers":[{"name":"sindresorhus","email":""}],"dist":{"shasum":"fc9a9050bd005ee7b42a9a497d075884e4a470f0","size":829,"noattachment":false,"key":"/lazy-req/-/lazy-req-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/lazy-req/download/lazy-req-1.0.0.tgz"},"directories":{},"publish_time":1408204871014,"_cnpm_publish_time":1408204871014,"_hasShrinkwrap":false}},"readme":"# lazy-req [![Build Status](https://travis-ci.org/sindresorhus/lazy-req.svg?branch=master)](https://travis-ci.org/sindresorhus/lazy-req)\n\n> Require modules lazily\n\n\n## Install\n\n```\n$ npm install --save lazy-req\n```\n\n\n## Usage\n\n```js\n// pass in `require` or a custom require function\nconst lazyReq = require('lazy-req')(require);\nconst _ = lazyReq('lodash');\n\n// Where you would normally do\n_.isNumber(2);\n\n// You now instead call it as a function\n_().isNumber(2);\n\n// It's cached on consecutive calls\n_().isString('unicorn');\n\n// Extract lazy variations of the props you need\nconst members = lazyReq('lodash')('isNumber', 'isString');\n\n// Useful when using destructuring assignment in ES2015\nconst {isNumber, isString} = lazyReq('lodash')('isNumber', 'isString');\n\n// Works out of the box for functions and regular properties\nconst stuff = lazyReq('./math-lib')('sum', 'PHI');\nconsole.log(stuff.sum(1, 2)); // => 3\nconsole.log(stuff.PHI); // => 1.618033\n```\n\n### Proxy support in Node.js 6 or later\n\nIf you use Node.js 6 or later, you can take advantage of ES2015 proxies and don't need to call it as a function.\n\n```js\nconst lazyReq = require('lazy-req').proxy(require);\nconst _ = lazyReq('lodash');\n\n// No need to call it as a function but still lazily required\n_.isNumber(2);\n```\n\n## Related\n\n- [resolve-from](https://github.com/sindresorhus/resolve-from) - Resolve the path of a module from a given path\n- [req-from](https://github.com/sindresorhus/req-from) - Require a module from a given path\n- [resolve-pkg](https://github.com/sindresorhus/resolve-pkg) - Resolve the path of a package regardless of it having an entry point\n- [lazy-value](https://github.com/sindresorhus/lazy-value) - Create a lazily evaluated value\n- [define-lazy-prop](https://github.com/sindresorhus/define-lazy-prop) - Define a lazily evaluated property on an object\n\n\n## License\n\nMIT © [Sindre Sorhus](https://sindresorhus.com)\n","_attachments":{},"homepage":"https://github.com/sindresorhus/lazy-req#readme","bugs":{"url":"https://github.com/sindresorhus/lazy-req/issues"},"license":"MIT"}