Skip to content

Lcfvs/rwin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 

Repository files navigation

rwin

Actual version published on NPM Downloads

Like to keep your requires in the script header?

Tired to load modules that will possibly not been used and overloading your RAM?

Require When It Needeed is a lightweight tool that loads (synchronously) the required module only when and if you really need it!

This Node.js module is under MIT License.

Install :

$ npm install rwin

Usage :

lib = rwin(imports, [dirname]);

Where :

lib : is an object that contains an accessor for each required modules

imports : is an object that contains the accessor name paired with the module path

dirname : is the source path, generally __dirname (useless if You only require installed modules)

Example:

var rwin,
    imports,
    lib;

rwin = require('rwin');

imports = {
    installedModule: 'installed-module',
    uninstalledModule: '/uninstalled-module/path'
};

lib = rwin(imports, __dirname);

// At this point, rwin is the only one loaded module (and its own dependencies)

console.log(lib.installedModule); // loads the module & returns it to the console

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published