# loopback-extra-filters

> Provides extra filters for loopback queries

Latest version **1.0.5** (published 2019-08-28) · MIT license · 0 weekly downloads

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

## Install

```sh
npm install loopback-extra-filters
pnpm add loopback-extra-filters
yarn add loopback-extra-filters
bun add loopback-extra-filters
```

## Health

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

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.5 |
| Published | 2019-08-28 |
| First published | 2019-04-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 42.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Herberts Cruz |
| Maintainers | herbertscruz |
| Keywords | StrongLoop, LoopBack, Extra, Filter |

## Links

- npm: https://www.npmjs.com/package/loopback-extra-filters
- Repository: https://github.com/herbertscruz/loopback-extra-filters
- Homepage: https://github.com/herbertscruz/loopback-extra-filters#readme
- Issues: https://github.com/herbertscruz/loopback-extra-filters/issues
- npm.io page: https://npm.io/package/loopback-extra-filters

## Dependencies (1)

- [lodash](https://npm.io/package/lodash.md) ^4.17.15

## Recent versions

- 1.0.5 (latest) — 2019-08-28
- 1.0.4 — 2019-08-28
- 1.0.3 — 2019-04-26
- 1.0.2 — 2019-04-25
- 1.0.1 — 2019-04-25
- 1.0.0 — 2019-04-25

## README

# loopback-extra-filters
This package is designed to provide filter alternatives under the loopback query data.

The extra filters do not change queries generated by [loopback-datasource-juggler](https://github.com/strongloop/loopback-datasource-juggler), but are applied to the resulting object.

### Install

```javascript
// server/boot/extra-filters.js
'use strict';

const Boot = require('loopback-extra-filters/lib/boot');

module.exports = function(server) {
  Boot.apply(server);
};
```

### Filters

- has - Check if you have the property.
- notHas - Check if you do not have the property.
- isEmpty -Check if array property is empty
- isNotEmpty - Check if array property is not empty.

### Examples

- Filter:

```javascript
// Product has category (Ex.: relation belongsTo)
{
  "include": {
    "relation": "category",
  },
  "isHas": "category" //or ["category", ...]
}

// Product has no category (Ex.: relation belongsTo)
{
  "include": {
    "relation": "category",
  },
  "isHas": "category" //or ["category", ...]
}

// Product without items (Ex.: relation hasMany)
{
  "include": {
    "relation": "items",
  },
  "isEmpty": "items" //or ["items", ...]
}

// Product with items (Ex.: relation hasMany)
{
  "include": {
    "relation": "items",
  },
  "isNotEmpty": "items" //or ["items", ...]
}
```

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