filtered
v0.1.5
Published
Text based filter and search for firebase cloud firestore and array of objects
Downloads
11
Maintainers
Readme
Introducing filtered
Text based filter and search service for firebase cloud firestore collections and any array of objects
Install filtered via NPM
npm i filtered --save
Get filtered over CDN as an E6 Module
import { filtered } from "https://unpkg.com/filtered/esm/index.js";
Install and import filtered in your app
import { filtered } from "filtered";
API Spec
Filtered receives an object with three required keys as shown below;
Firebase cloud firestore collection
Pass an additional firestore param for firebase cloud firestone text-based collection document search.
// Do some awesome filtering....
//...
const result = filtered({
data,
firestore: true,
filter,
query,
});
For any array of objects
// Do some awesome filtering....
//...
const result = filtered({
data,
filter,
query,
});
Parameters
| Name | Type | Required | Description |
| --------- | ---------------- | -------- | -------------------------------------------------------------------------------------- |
| data | array of objects | true | An array of objects or firebase cloud firestore collection documents array |
| firestore | boolean | false | Must be set to true
if passing firebase cloud firestore collection documents |
| filter | string | true | The field or key to filter against in an object or cloud firestore collection document |
| query | string | true | The query string to filter with |
Response
| Name | Type | Description | | ------ | ---------------- | ------------------------------------------------------------------- | | result | array of objects | Query result - an array of found items, could be empty if no result |
Enjoy!