about
yalazy
(Yet Another Lazy Loader) is a super simple lazy loader for modules and directories, It's borderline too small to merit its own module but, here it is
installation
npm install --save yalazy
example
const yalazy = const getSomeModule = const myModules = yalazymyModules'moduleByFileOrDirectoryName'
API
yalazy(path, method)
path
- full or relative path to module file or directory- 'method' (optional) - specific method to load from within the module
yalazy.directory(path, options = {})
path
- full or relative path to modules directoryoptions.camelCase
- convert module filenames to camelCaseoptions.requireWith
- allow manually requiring and optionally adjusting the module before assignment: eg:requireWith: (modules, filename) => require(filename)
options.lazyProperties
- an object defining additional properties to lazyLoad, eg:lazyProperties: { client: (modules) => { return 'clientObject' }
License: MIT