# is-subset-of

> is-subset-of verifies whether an array or an object is a subset.

Latest version **3.1.10** (published 2021-08-24) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install is-subset-of
pnpm add is-subset-of
yarn add is-subset-of
bun add is-subset-of
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 3.1.10 |
| Published | 2021-08-24 |
| First published | 2019-03-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 17.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | thenativeweb-admin, goloroden, yeldir, nhummel, dotkuro |
| Keywords | array, object, subset |

## Links

- npm: https://www.npmjs.com/package/is-subset-of
- Repository: https://github.com/thenativeweb/is-subset-of
- Homepage: https://github.com/thenativeweb/is-subset-of#readme
- Issues: https://github.com/thenativeweb/is-subset-of/issues
- npm.io page: https://npm.io/package/is-subset-of

## Dependencies (1)

- [typedescriptor](https://npm.io/package/typedescriptor.md) 3.0.2

## Recent versions

- 3.1.10 (latest) — 2021-08-24
- 3.1.9 — 2021-08-15
- 3.1.8 — 2021-06-10
- 3.1.7 — 2021-06-10
- 3.1.6 — 2021-06-10
- 3.1.5 — 2021-05-11
- 3.1.4 — 2021-03-25
- 3.1.3 — 2021-03-25
- 3.1.2 — 2020-11-03
- 3.1.1 — 2020-11-03
- 3.1.0 — 2020-03-19
- 3.0.0 — 2019-11-15
- 2.0.3 — 2019-09-19
- 2.0.1 — 2019-09-05
- 2.0.0 — 2019-08-23
- … 3 more at https://npm.io/package/is-subset-of/versions

## README

# is-subset-of

is-subset-of verifies whether an array or an object is a subset.

## Status

| Category         | Status                                                                                                    |
| ---------------- | --------------------------------------------------------------------------------------------------------- |
| Version          | [![npm](https://img.shields.io/npm/v/is-subset-of)](https://www.npmjs.com/package/is-subset-of)           |
| Dependencies     | ![David](https://img.shields.io/david/thenativeweb/is-subset-of)                                          |
| Dev dependencies | ![David](https://img.shields.io/david/dev/thenativeweb/is-subset-of)                                      |
| Build            | ![GitHub Actions](https://github.com/thenativeweb/is-subset-of/workflows/Release/badge.svg?branch=main) |
| License          | ![GitHub](https://img.shields.io/github/license/thenativeweb/is-subset-of)                                |

## Installation

```shell
$ npm install is-subset-of
```

## Quick Start

First you need to add a reference to is-subset-of to your application:

```javascript
const { isSubsetOf } = require('is-subset-of');
```

If you use TypeScript, use the following code instead:

```typescript
import { isSubsetOf } from 'is-subset-of';
```

Then you can verify if an array or an object is a subset of another array or object by calling the `isSubsetOf` function and handing over the arrays or objects:

```javascript
console.log(isSubsetOf(
  [ 2, 3, 5 ],
  [ 2, 3, 5, 7, 11 ]
));
// => true

console.log(isSubsetOf(
  { name: 'the native web' },
  { name: 'the native web', city: 'Riegel am Kaiserstuhl' },
));
// => true
```

### Verifying subsets structurally

From time to time, you are only interested if one object is a structural subset of another object, i.e. if its keys are contained within the other one, but you want to ignore the values. For that, use the `isSubsetOf.structural` function:

```javascript
console.log(isSubsetOf.structural(
  { name: 'Node.js' },
  { name: 'the native web', city: 'Riegel am Kaiserstuhl' }
));
// => true

console.log(isSubsetOf.structural(
  { firstName: 'Golo', lastName: 'Roden' },
  { name: 'the native web' }
));
// => false
```

## Running quality assurance

To run quality assurance for this module use [roboter](https://www.npmjs.com/package/roboter):

```shell
$ npx roboter
```

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