# @lamansky/every

> A better Array.prototype.every(). Supports iterables, whitelist testing, and more.

Latest version **1.0.0** (published 2018-05-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install @lamansky/every
pnpm add @lamansky/every
yarn add @lamansky/every
bun add @lamansky/every
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2018-05-23 |
| First published | 2018-05-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=6.0.0 |
| Dependencies | 3 |
| Unpacked size | 3.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | John Lamansky |
| Maintainers | lamansky |
| Keywords | iterable, array, every, test |

## Links

- npm: https://www.npmjs.com/package/@lamansky/every
- Repository: https://github.com/lamansky/every
- Issues: https://github.com/lamansky/every/issues
- npm.io page: https://npm.io/package/@lamansky/every

## Dependencies (3)

- [ffn](https://npm.io/package/ffn.md) ^2.1.0
- [sbo](https://npm.io/package/sbo.md) ^1.1.0
- [plainify](https://npm.io/package/plainify.md) ^1.0.0

## Alternatives

- [duck](https://npm.io/package/duck.md) — 4.2M weekly downloads
- [ava](https://npm.io/package/ava.md) — 560.2K weekly downloads
- [storybook-addon-module-mock](https://npm.io/package/storybook-addon-module-mock.md) — 71.7K weekly downloads
- [vest](https://npm.io/package/vest.md) — 50.1K weekly downloads
- [@ethereum-waffle/mock-contract](https://npm.io/package/@ethereum-waffle/mock-contract.md) — 40.0K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2018-05-23

## README

# every

A better `Array.prototype.every()`. Supports iterables, whitelist testing, and more.

## Installation

Requires [Node.js](https://nodejs.org/) 6.0.0 or above.

```bash
npm i @lamansky/every
```

## API

The module exports a single function.

### Parameters

1. Bindable: `iter` (iterable)
2. Optional: `test` (function, array, or any): If a function is provided, iterated values will be evaluated on whether `test` returns `true` when passed the value. If an array is provided, iterated values will be evaluated on whether they are contained in the array. If some other value is provided, iterated values will be evaluated on whether they strictly equal `test`. If `test` is omitted, iterated values will be evaluated on whether they are truthy.
3. Optional: Object argument (_or_ a value for `vacuously`):
    * `vacuously` (boolean): What to return if `iter` doesn’t iterate anything. Defaults to `true`. Thiis is for consistency with [`Array.prototype.every()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every), which interprets any test on an empty array as being [vacuously true](https://en.wikipedia.org/wiki/Vacuous_truth).

### Return Values

* If `iter` doesn’t iterate anything, returns `vacuously` if set, otherwise `true`.
* Otherwise, returns `true` if every one of the iterated values of `iter` passes `test`; otherwise returns `false`.

## Example

```javascript
const every = require('@lamansky/every')

const arr = [1, 2, 3]

every(arr, n => n >= 1) // true
every(arr, [1, 2, 3, 4]) // true

every(arr, n => n > 1) // false
every(arr, 1) // false
every(arr, [1, 2]) // false
```

## Related

* [some](https://github.com/lamansky/some)

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