npm.io
1.0.2 • Published 6 years ago

read-package

Licence
MIT
Version
1.0.2
Deps
1
Size
3 kB
Vulns
0
Weekly
0

read-package Build Status

Reads package.json in the working directory.

Install

$ yarn add read-package

Usage

.
├── foo
│   └── ...
└── bar
    └── package.json
const readPackage = require('read-package')

readPackage('foo')
//=> package.json not found in the current project.

readPackage('bar')
//=> { "name": "fixture", "version": "1.0.0" }

API

readPackage([cwd])

Returns an object or throws an error.

cwd

Type: string
Default: process.cwd()

Current working directory.

License

MIT Bu Kinoshita

Keywords