2.0.3 • Published 5 years ago

kizazi v2.0.3

Weekly downloads
2
License
ISC
Repository
github
Last release
5 years ago

Kizazi

Build Status

A simple module mapping library.

Please refer to kizazi-legacy for version <2.x

Installation

$ npm i kizazi

Run test

$ npm test

Usage

Create global file and configure your module map.

// global.js
const k = require('kizazi');
const root = __dirname;

//set root
k.setRoot(root);

//use labels to map module(s)
//first parameter is label name, last is module path.
k.setLabel('module1', '/path/to/module');
k.setLabel('module2', '/path/to/module');
...
k.setLabel('moduleN', '/path/to/module');

module.exports = k;

Require global.js file in file for use.

// someFile.js
let G = require('/path/to/global.js');
let module1 = G.label('module1').val;
let module2 = G.label('module2').val;
...

// someOtherFile.js
let G = require('/path/to/global.js');
let module1 = G.label('module1').val;
let module2 = G.label('module2').val;
...

Access module path using .path, instead of .val

let module1 = G.label('module1').path;
//=> /path/to/module1

Addition

//set multiple labels
k.setLabelMany({
  module1: '/path/to/module',
  module2: '/path/to/module',
  ...
  moduleN: '/path/to/module'
});

//append path to existing path
G.label('module1').app('/path/extension');
G.app('/path/to/module');
2.0.3

5 years ago

2.0.2

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.1.0

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago