Skip to content

zhangaz1/import-global

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

import-global Build Status

Import a globally installed module

Please don't use this unless absolutely necessary. Local dependencies should be preferred.

Install

$ npm install import-global

Usage

$ npm install --global cat-names
const importGlobal = require('import-global');
const catNames = importGlobal('cat-names');

catNames.random();
//=> 'Snuggles'

API

importGlobal(moduleId)

Throws if the module can't be found.

importGlobal.silent(moduleId)

Returns null instead of throwing if the module can't be found.

moduleId

Type: string

What you would use in require().

Related

License

MIT © Sindre Sorhus

About

Import a globally installed module

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%