Andrea Gaertner 668e16c315 Einkaufsliste application_liste hinzugefügt | 3 years ago | |
---|---|---|
.. | ||
index.js | 3 years ago | |
license | 3 years ago | |
package.json | 3 years ago | |
readme.md | 3 years ago |
Import a module lazily
Note: Version 3 is exclusively Proxy
-based and requires Node.js 6+. Use version 2 if you need Node.js <=5 support.
$ npm install import-lazy
// Pass in `require` or a custom import function
const importLazy = require('import-lazy')(require);
const _ = importLazy('lodash');
// Instead of referring to its exported properties directly…
_.isNumber(2);
// …it's cached on consecutive calls
_.isNumber('unicorn');
// It also works using destructuring assignment in ES2015
const {isNumber, isString} = importLazy('lodash');
// Works out of the box for functions and regular properties
const stuff = importLazy('./math-lib');
console.log(stuff.sum(1, 2)); // => 3
console.log(stuff.PHI); // => 1.618033
MIT © Sindre Sorhus