Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/vdegenne/pkg-has

Just checking if package.json contains a given package.
https://github.com/vdegenne/pkg-has

Last synced: about 2 months ago
JSON representation

Just checking if package.json contains a given package.

Awesome Lists containing this project

README

        

[![Build Status](https://travis-ci.org/vdegenne/pkg-has.svg)](https://travis-ci.org/vdegenne/pkg-has)
[![npm](https://img.shields.io/npm/v/pkg-has.svg)](https://www.npmjs.com/package/pkg-has)

# pkg-has

Just checking if package.json contains a given package.

## Usage

```javascript
does_my_project_have_mocha = require('pkg-has')('mocha');
```

or use a wide search

```javascript
const findings = require('pkg-has').wideSearch('cha');
// findings = ["mocha", "chai"]
```

**installation :** `yarn add pkg-has`

## Command-line Usage

```sudo yarn global add pkg-has```

## notes

it will test against the `package.json` based on the current position, so if you are in a directory of your project it will test with your `package.json` as you would expect. But now if you are in a dependency directory structure (e.g. `./node_modules/chai`), it will test against this dependency `package.json`. So beware.