1.0.1 • Published 6 years ago

both-require v1.0.1

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

both-require

Require to both way of relatively and absolutely.

Intro

both-require was born for solving require hell as you can see below.

const moduleA = require('../../../../moduleA');

and then you can use relative path, additionally. because of support both way path.

Install

npm install both-require --save

How to use

require using absoulte path

const use = require('both-require');
const moduleA = use('moduleA');

require using relative path

const use = require('both-require');
const moduleB = use('./moduleB'); //It's the same to pure require.

Advantage

If used both-require, able to split code of require public module & private module, intuitively.

const use = require('both-require');

const pubModule = require('pubModule');
const priModule = use('priModule');

Authors

tinyjin - Github, Blog

License

This project has MIT License.