Projekt

Obecné

Profil

Stáhnout (798 Bajtů) Statistiky
| Větev: | Revize:
1
# import-local [![Build Status](https://travis-ci.org/sindresorhus/import-local.svg?branch=master)](https://travis-ci.org/sindresorhus/import-local)
2

    
3
> Let a globally installed package use a locally installed version of itself if available
4

    
5
Useful for CLI tools that want to defer to the user's locally installed version when available, but still work if it's not installed locally. For example, [AVA](http://ava.li) and [XO](https://github.com/xojs/xo) uses this method.
6

    
7

    
8
## Install
9

    
10
```
11
$ npm install import-local
12
```
13

    
14

    
15
## Usage
16

    
17
```js
18
const importLocal = require('import-local');
19

    
20
if (importLocal(__filename)) {
21
	console.log('Using local version of this package');
22
} else {
23
	// Code for both global and local version here…
24
}
25
```
26

    
27

    
28
## License
29

    
30
MIT © [Sindre Sorhus](https://sindresorhus.com)
(4-4/4)