# has-package

> Check if a project has package.json

Latest version **1.0.6** (published 2020-07-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install has-package
pnpm add has-package
yarn add has-package
bun add has-package
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.6 |
| Published | 2020-07-17 |
| First published | 2017-06-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=10 |
| Dependencies | 0 |
| Unpacked size | 2.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Bu Kinoshita |
| Maintainers | bukinoshita |
| Keywords | npm, package, package.json, checker, check, json |

## Links

- npm: https://www.npmjs.com/package/has-package
- Repository: https://github.com/bukinoshita/has-package
- npm.io page: https://npm.io/package/has-package

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.0.6 (latest) — 2020-07-17
- 1.0.5 — 2020-05-08
- 1.0.4 — 2020-05-01
- 1.0.3 — 2020-04-29
- 1.0.2 — 2020-01-07
- 1.0.1 — 2020-01-03
- 1.0.0 — 2020-01-03
- 0.0.2 — 2017-07-07
- 0.0.1 — 2017-06-16

## README

# has-package [![Build Status](https://travis-ci.org/bukinoshita/has-package.svg?branch=master)](https://travis-ci.org/bukinoshita/has-package)

> Check if a project has [package.json](https://docs.npmjs.com/files/package.json)

Checks if a `package.json` file is present in the working directory.

## Install

```
$ yarn add has-package
```

## Usage

```
.
├── foo
│   └── ...
└── bar
    └── package.json
```

```js
const hasPackage = require('has-package')

hasPackage('foo')
//=> false

hasPackage('bar')
//=> true
```

## API

### hasPackage([cwd])

Returns a `boolean`.

#### cwd

Type: `string`<br>
Default: `process.cwd()`

Current working directory.

## Related

- [read-package](https://github.com/bukinoshita/read-package) — Reads package.json in the working directory

## License

MIT © [Bu Kinoshita](https://bukinoshita.com)

---
_Source: https://npm.io/package/has-package · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
