1.1.8 • Published 10 years ago

irequire v1.1.8

Weekly downloads
2
License
MIT
Repository
github
Last release
10 years ago

IRequire

Node.JS require extension. It will add some aditional functionality to standard require function.

IRequire is fully compatible with require.

Instalation

npm install --save irequire

Usage

in main file - app.js for example

var path = require('path');
global.irequire = require('irequire')(); 

var net = irequire("net"); // irequire is fully compatible with require

// you can define prefixes to remember some key paths
irequire.prefix("controllers",path.join(__dirname,"app/controllers/"));
irequire.prefix("config",path.join(__dirname,"config"));

//loading modules 
var someconfig = irequire("config:some"); 
var home = irequire("controllers:home");

//as prefix you can use function
irequire.prefix("ext",function(query){
	if(query.key == "mod1")
		return __dirname+"/module1.js";
	else
		throw new Error("Unknown key");
});

var mod = irequire("ext:mod1") // will load ./module1.js
var mod2 = irequire("ext:anyelse") // will throw error

Have fun :)

License

MIT License Copyright © 2014 Mateusz Russak

1.1.8

10 years ago

1.1.7

10 years ago

1.1.6

10 years ago

1.1.5

10 years ago

1.1.4

10 years ago

1.1.3

10 years ago

1.1.2

11 years ago

1.1.1

11 years ago

1.1.0

11 years ago

1.0.3

11 years ago

1.0.2

11 years ago

1.0.1

11 years ago

1.0.0

11 years ago