2.0.3 • Published 5 years ago

find-main v2.0.3

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

find-main Build Status Greenkeeper badge

Find the "main" path from package.json

Install

$ npm install --save find-main

Usage

var findMain = require('find-main');

findMain(cwd);
//=> ./path/to/main

API

findMain([cwd]) -> String / Boolean

findMain starts at cwd and looks upwards until it finds a package.json. When it finds one, it returns the "main" entry as an absolute path.

If no package is found, an exception is thrown. If a package is found but no "main" entry is available, false is returned. Otherwise, the absolute main path is returned.

cwd

Type: string
Default: process.cwd()

License

MIT © Ben Drucker