Skip to content

Commit 9fbb61c

Browse files
release: v0.2.0
1 parent aa38f5c commit 9fbb61c

File tree

4 files changed

+27
-6
lines changed

4 files changed

+27
-6
lines changed

README.md

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Simple but fast data filter.
2020

2121
_*The results are little different in partial search._
2222

23-
| | match-sorter (6.3.1) | fuse.js (6.6.2) | filter-data (0.1.3) |
23+
| | match-sorter (6.3.1) | fuse.js (6.6.2) | filter-data (0.2.0) |
2424
| :--- | :--: | :-: | :--: |
2525
| match all, 1 key | 10.947ms | 4.244ms | <span style="color: green">1.827ms</span> |
2626
| no match, 1 key | <span style="color: green">0.523ms</span> | 2.385ms | 2.958ms |
@@ -37,7 +37,7 @@ Simple but fast data filter.
3737

3838
_*The results are little different in partial search._
3939

40-
| | match-sorter (4.0.2) | fuse.js (3.4.6) | filter-data (0.1.1) |
40+
| | match-sorter (4.0.2) | fuse.js (3.4.6) | filter-data (0.2.0) |
4141
| :--- | :--: | :-: | :--: |
4242
| match all, 1 key | 21.439ms | 49.336ms | <span style="color: green">16.884ms</span> |
4343
| no match, 1 key | 18.239ms | 33.312ms | <span style="color: green">6.382ms</span> |
@@ -53,7 +53,7 @@ Simple but fast data filter.
5353
## Install From Browser
5454

5555
```html
56-
<script src="https://cdn.jsdelivr.net/npm/filter-data@0.1.3/dist/filterdata.min.js"></script>
56+
<script src="https://cdn.jsdelivr.net/npm/filter-data@0.2.0/dist/filterdata.min.js"></script>
5757
```
5858

5959
## Installation
@@ -179,6 +179,27 @@ const { filterData, SearchType } = FilterData;
179179
] -->
180180
```
181181

182+
1. search nested object.
183+
184+
```js
185+
import { filterData, SearchType } from 'filter-data';
186+
187+
// search firstName in father's sub object equals to 'dan'
188+
const searchConditions = [
189+
{
190+
key: 'father.firstName', // or key: [['father', 'firstName']]
191+
value: 'dan',
192+
type: SearchType.EQ,
193+
},
194+
];
195+
196+
const result = filterData(data, searchConditions);
197+
// output:
198+
<!-- [
199+
{ firstName: 'Jordan', age: 17, father: { firstName: 'dan', age: 50 } },
200+
] -->
201+
```
202+
182203
## Instructions
183204

184205
| No. | Parameter | required | Default | Description |

0 commit comments

Comments
 (0)