Gathering detailed insights and metrics for @amn31/filter-multiple-conditions
Gathering detailed insights and metrics for @amn31/filter-multiple-conditions
npm install @amn31/filter-multiple-conditions
Typescript
Module System
Node Version
NPM Version
74
Supply Chain
98.9
Quality
75.2
Maintenance
100
Vulnerability
100
License
Total Downloads
9,765
Last Day
8
Last Week
21
Last Month
110
Last Year
2,043
Minified
Minified + Gzipped
Latest Version
1.0.2
Package Id
@amn31/filter-multiple-conditions@1.0.2
Unpacked Size
45.92 kB
Size
9.93 kB
File Count
13
NPM Version
6.14.4
Node Version
12.16.3
Cumulative downloads
Total Downloads
Last day
100%
8
Compared to previous day
Last week
-34.4%
21
Compared to previous week
Last month
2.8%
110
Compared to previous month
Last year
-59.3%
2,043
Compared to previous year
3
To simplify searching in a array of objects like a SQL query, you can use [amn31@filter-multiple-conditions]. If datas is stored in database, you can use package [@amn31/convert2sequelize] to complete your needs.
1 2 // Example of request 3 let whereJSON = [ 4 [ 5 "Imei", 6 "not like", 7 "'%33680090%'" 8 ], 9 "and", 10 [ 11 [ 12 "EnrollmentStatus", 13 "=", 14 "Unnrolled" 15 ], 16 "or", 17 [ 18 "EnrollmentStatus", 19 "=", 20 "Enrolled" 21 ], 22 ] 23 ]
$ npm install @amn31/filter-multiple-conditions
How use [amn31@filter-multiple-conditions] ?
1 2 import { FilterConditions, MaFilter } from "@amn31/filter-multiple-conditions" 3 4 // Create query 5 let conditions :FilterConditions = [ 6 [ 7 "id", 8 ">", 9 // Number 10 "13" 11 ], 12 "and", 13 [ 14 [ 15 "isLeasing", 16 "=", 17 "1" // '1' => true, 18 ], 19 "or", 20 [ 21 [ 22 "isLeasing", 23 "isnull", 24 "" 25 ], 26 "and", 27 [ 28 "Platform", 29 "like", 30 "%Apple%" 31 ], 32 ] 33 ] 34 ]; 35 36 // Data to filter 37 let data = [ 38 ... 39 { 40 "id": 10, 41 "Imei": "01326007739292", 42 "Platform": "Apple", 43 "Model": "iPad 3rd Gen LTE (GSM) (64 GB)", 44 "OperatingSystem": "9.3.5", 45 "EnrollmentStatus": "Enrolled", 46 "lastseen": "2021-02-08", 47 "isLeasing": true 48 }, 49 ... 50 ] 51 52 // Result of filtering 53 let dataFiltered = MaFilter.FilterByConditions(conditions, data); 54 55 console.log(dataFiltered); 56 57 // FilterByConditions can sort result if you add options 'field' 58 let dataFilteredAndSorted = MaFilter.FilterByConditions( 59 conditions, 60 data, 61 { 62 field: 'id' 63 }); 64 65 // FilterByConditions can reverse the sorted result if you add options 'reverse'} 66 let dataFilteredAndSorted = MaFilter.FilterByConditions( 67 conditions, 68 data, 69 { 70 field: 'id', 71 reverse: true 72 }); 73
1 and
2 or
3 =
4 !=
5 >
6 <
7 >=
8 <=
9 like
10 not like
11 regex
12 notRegexp
13 startswith
14 endswith
15 contains
16 isnull
17 isnotnull
No vulnerabilities found.
No security vulnerabilities found.