# chai-quantifiers

> Array quantifier assertions for chai assertion library

Latest version **1.0.18** (published 2024-02-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install chai-quantifiers
pnpm add chai-quantifiers
yarn add chai-quantifiers
bun add chai-quantifiers
```

## 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.18 |
| Published | 2024-02-26 |
| First published | 2018-02-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=12.x.x |
| Dependencies | 0 |
| Unpacked size | 9.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | Frank Thelen> |
| Maintainers | shurik239, frankthelen, sueverkm |
| Keywords | chai, assertions, chai-plugin, quantifiers, array |

## Links

- npm: https://www.npmjs.com/package/chai-quantifiers
- Repository: https://github.com/funny-bytes/chai-quantifiers
- Homepage: https://github.com/funny-bytes/chai-quantifiers#readme
- Issues: https://github.com/funny-bytes/chai-quantifiers/issues
- npm.io page: https://npm.io/package/chai-quantifiers

## Recent versions

- 1.0.18 (latest) — 2024-02-26
- 1.0.17 — 2022-07-04
- 1.0.16 — 2021-11-04
- 1.0.15 — 2021-08-30
- 1.0.13 — 2021-01-09
- 1.0.12 — 2021-01-09
- 1.0.11 — 2020-12-27
- 1.0.10 — 2020-09-12
- 1.0.9 — 2020-01-27
- 1.0.8 — 2020-01-24
- 1.0.7 — 2019-07-11
- 1.0.6 — 2019-05-01
- 1.0.5 — 2019-03-27
- 1.0.4 — 2018-08-18
- 1.0.3 — 2018-08-10
- … 8 more at https://npm.io/package/chai-quantifiers/versions

## README

# chai-quantifiers

Array quantifier assertions for [Chai](http://chaijs.com/) assertion library.

![main workflow](https://github.com/funny-bytes/chai-quantifiers/actions/workflows/main.yml/badge.svg)
[![Coverage Status](https://coveralls.io/repos/github/funny-bytes/chai-quantifiers/badge.svg?branch=master)](https://coveralls.io/github/funny-bytes/chai-quantifiers?branch=master)
[![Maintainability](https://api.codeclimate.com/v1/badges/44fb4c780c3f36b0d04f/maintainability)](https://codeclimate.com/github/funny-bytes/chai-quantifiers/maintainability)
[![node](https://img.shields.io/node/v/chai-quantifiers.svg)]()
[![code style](https://img.shields.io/badge/code_style-airbnb-brightgreen.svg)](https://github.com/airbnb/javascript)
[![Types](https://img.shields.io/npm/types/chai-quantifiers.svg)](https://www.npmjs.com/package/chai-quantifiers)
[![License Status](http://img.shields.io/npm/l/chai-quantifiers.svg)]()

## Install

```bash
npm install --save-dev chai chai-quantifiers
```

## Usage

There are three assertions available, applicable to arrays.

* containAll -- Asserts that all array items are true in respect to a predicate.
* containOne -- Asserts that at least one array item is true in respect to a predicate.
* containExactlyOne -- Asserts that exactly one array item is true in respect to a predicate.

A quick example:

```javascript
const chai = require('chai');
const chaiQuantifiers = require('chai-quantifiers');

chai.use(chaiQuantifiers);

const { expect } = chai;

describe('chai-quantifiers', () => {
  it('containAll should be true if all items are true', () => {
    expect([0, 1, 2, 3]).to.containAll(item => item < 4);
  });
  it('containOne should be true if at least one item is true', () => {
    expect([0, 1, 2, 3]).to.containOne(item => item >= 2);
  });
  it('containExactlyOne should be true if exactly one item is true', () => {
    expect([0, 1, 2, 3]).to.containExactlyOne(item => item === 2);
  });
});
```

This module also includes types for *TypeScript*.

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