Sha256: b9d399aabe5939185404a0e5f1f0f780e9b52defbcf727e80dbc5352535ccab8
Contents?: true
Size: 640 Bytes
Versions: 57
Compression:
Stored size: 640 Bytes
Contents
/** Import a module lazily. @example ``` // Pass in `require` or a custom import function import importLazy = require('import-lazy'); const _ = importLazy(require)('lodash'); // Instead of referring to its exported properties directly… _.isNumber(2); // …it's cached on consecutive calls _.isNumber('unicorn'); // Works out of the box for functions and regular properties const stuff = importLazy(require)('./math-lib'); console.log(stuff.sum(1, 2)); // => 3 console.log(stuff.PHI); // => 1.618033 ``` */ declare function importLazy<T = unknown>( importFn: (moduleId: string) => T ): (moduleId: string) => T; export = importLazy;
Version data entries
57 entries across 57 versions & 2 rubygems