# deep-array-filter

> Filters an array of objects with filters defined in an object.

Latest version **1.0.4** (published 2018-09-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install deep-array-filter
pnpm add deep-array-filter
yarn add deep-array-filter
bun add deep-array-filter
```

## 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.4 |
| Published | 2018-09-21 |
| First published | 2018-09-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 5.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | maurer-new-media |
| Keywords | array, filter, search, deep-filter, deep-search |

## Links

- npm: https://www.npmjs.com/package/deep-array-filter
- npm.io page: https://npm.io/package/deep-array-filter

## Dependencies (1)

- [flatten-unflatten](https://npm.io/package/flatten-unflatten.md) ^1.0.0

## Alternatives

- [jsforce](https://npm.io/package/jsforce.md) — 851.2K weekly downloads
- [react-native-qrcode-svg](https://npm.io/package/react-native-qrcode-svg.md) — 693.5K weekly downloads
- [@salesforce/plugin-data](https://npm.io/package/@salesforce/plugin-data.md) — 394.9K weekly downloads
- [@backstage/plugin-search-common](https://npm.io/package/@backstage/plugin-search-common.md) — 308.5K weekly downloads
- [@chain-registry/types](https://npm.io/package/@chain-registry/types.md) — 38.4K weekly downloads

## Recent versions

- 1.0.4 (latest) — 2018-09-21
- 1.0.3 — 2018-09-20
- 1.0.2 — 2018-09-20
- 1.0.1 — 2018-09-04
- 1.0.0 — 2018-09-03

## README

# deep-array-filter
Filters an array of objects.

```
npm i deep-array-filter
```

### Define your filter values:
the property `$` will search in all keys.
```js
let filterBy = {
    $: 'wayne',
    firstname: 'john',
    age: 18,
    address: {
        city: 'Basel'
    }
};
```

### FilterTypes
Define type of your filters:

If not defined it will default to `includes`.
```js
let filterTypes = {
    age: 'gt',
    address: { 
        city: 'gt' 
    }
}
```

### Execute the filter
```js
let filteredArr = filter(arr, filterBy, filterTypes)
```

<hr>

## Filters
Currently there are following filters defined:
- includes - substring matching
- gt - greater than
- lt - less than

If you need more, open an Issue or send a PR.

### extend filterTypes
If you need more or different filters, you can provide you custom compare functions.
```js
let filterType = {
    age: 'customFilter'
};

let comparator = {
    customFilter: (value, filter) => {
        return value > filter;
    }
};

let filteredArr = filter(arr, filterBy, filterTypes, comparator)
```

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