1.1.0 • Published 5 years ago

this v1.1.0

Weekly downloads
47
License
MIT
Repository
github
Last release
5 years ago

this

Traverses up the directory tree and returns the first module found

Build Status Coverage Status npm

Useful in tests so you don't have to require the package you're testing via relative paths.

Starts directory traversal from process.cwd() so this should really only be used in tests or CLI apps.

Install

npm install --save this

Or if using for tests you'll probably want:

npm install --save-dev this

Usage

Just require this the same way you would require the root module with a relative path.

e.g instead of:

import test from 'ava';
import myPackage from '../';

// and then in sub folders
import myPackage from '../../';

You can now do:

import test from 'ava';
import myPackage from 'this';

// and then in sub folders it's still just:
import myPackage from 'this';

e.g without import transpilation:

const test = require('tape');
const myPackage = require('this');

License

MIT © Luke Childs

1.1.0

5 years ago

1.0.2

7 years ago

1.0.1

7 years ago

0.1.7

11 years ago

0.1.6

11 years ago

0.1.5

11 years ago

0.1.4

11 years ago

0.1.1

11 years ago

0.1.0

11 years ago