# @arr/filter

> A tiny, faster alternative to native Array.prototype.filter

Latest version **1.0.2** (published 2019-10-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install @arr/filter
pnpm add @arr/filter
yarn add @arr/filter
bun add @arr/filter
```

## Health

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

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2019-10-23 |
| First published | 2017-07-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=4 |
| Dependencies | 0 |
| Unpacked size | 2.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 259 |
| Author | Luke Edwards |
| Maintainers | lukeed |
| Keywords | arr, array, Array.filter, Array.prototype.filter, performance, native, filter |

## Links

- npm: https://www.npmjs.com/package/@arr/filter
- Repository: https://github.com/lukeed/arr
- Homepage: https://github.com/lukeed/arr#readme
- Issues: https://github.com/lukeed/arr/issues
- npm.io page: https://npm.io/package/@arr/filter

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.2 (latest) — 2019-10-23
- 1.0.1 — 2019-10-23
- 1.0.0 — 2017-07-13
- 0.2.0 — 2017-07-13
- 0.1.0 — 2017-07-08

## README

# @arr/filter

> A tiny, faster alternative to native `Array.prototype.filter`

:warning: Unlike native, `@arr/filter` does _not_ support the optional `thisArg` parameter!

If you are okay with mutating the original, check out [`@arr/filter.mutate`](/packages/filter.mutate) for an **extremely fast** `filter` alternative!

## Install

```
$ npm install --save @arr/filter
```

## Usage

```js
import filter from '@arr/filter';

const words = ['foo', 'bar', 'baz', 'foobar', 'hello', 'world'];

filter(words, str => str.length > 3);
//=> ['foobar', 'hello', 'world']

console.log(words);
//=> ['foo', 'bar', 'baz', 'foobar', 'hello', 'world']
```

## API

### filter(arr, callback)

#### arr
Type: `Array`<br>
The array to iterate upon.

#### callback(value[, index, array])
Type: `Function`<br>
Function to test for each element, taking three arguments:

* **value** (required) -- The current element being processed in the array.
* **index** (optional) -- The index of the current element being processed in the array.
* **array** (optional) -- The array `filter` was called upon.


## License

MIT © [Luke Edwards](http://lukeed.com)

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