Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

readme.md 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. # import-lazy [![Build Status](https://travis-ci.org/sindresorhus/import-lazy.svg?branch=master)](https://travis-ci.org/sindresorhus/import-lazy)
  2. > Import a module lazily
  3. ## Install
  4. ```
  5. $ npm install import-lazy
  6. ```
  7. ## Usage
  8. ```js
  9. // Pass in `require` or a custom import function
  10. const importLazy = require('import-lazy')(require);
  11. const _ = importLazy('lodash');
  12. // Instead of referring to its exported properties directly…
  13. _.isNumber(2);
  14. // …it's cached on consecutive calls
  15. _.isNumber('unicorn');
  16. // Works out of the box for functions and regular properties
  17. const stuff = importLazy('./math-lib');
  18. console.log(stuff.sum(1, 2)); // => 3
  19. console.log(stuff.PHI); // => 1.618033
  20. ```
  21. ### Warning: Destructuring will cause it to fetch eagerly
  22. While you may be tempted to do leverage destructuring, like this:
  23. ```js
  24. const {isNumber, isString} = importLazy('lodash');
  25. ```
  26. Note that this will cause immediate property access, negating the lazy loading, and is equivalent to:
  27. ```js
  28. import {isNumber, isString} from 'lodash';
  29. ```
  30. ## Related
  31. - [resolve-from](https://github.com/sindresorhus/resolve-from) - Resolve the path of a module from a given path
  32. - [import-from](https://github.com/sindresorhus/import-from) - Import a module from a given path
  33. - [resolve-pkg](https://github.com/sindresorhus/resolve-pkg) - Resolve the path of a package regardless of it having an entry point
  34. - [lazy-value](https://github.com/sindresorhus/lazy-value) - Create a lazily evaluated value
  35. - [define-lazy-prop](https://github.com/sindresorhus/define-lazy-prop) - Define a lazily evaluated property on an object
  36. ## License
  37. MIT © [Sindre Sorhus](https://sindresorhus.com)