npm.io
1.0.4 • Published 5 years ago

import-by

Licence
MIT
Version
1.0.4
Deps
0
Size
5 kB
Vulns
0
Weekly
0
Stars
1

import-by

Import a module using a string reference

Installation

npm i import-by
# or
yarn add import-by

Usage

See the following example to understand how to use it

// detail.js
module.exports.beverage = {
    id: 12,
    name: 'coffee'
};
const {importBy} = require('import-by');

const beverage = importBy('./detail#beverage');

const beverageName = importBy('./detail#beverage.name', __dirname);

Keywords