Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/afeiship/next-where
Get collection items from condition map.
https://github.com/afeiship/next-where
condition map next where
Last synced: 18 days ago
JSON representation
Get collection items from condition map.
- Host: GitHub
- URL: https://github.com/afeiship/next-where
- Owner: afeiship
- License: mit
- Created: 2017-09-13T07:03:49.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2020-11-22T05:41:54.000Z (almost 4 years ago)
- Last Synced: 2024-10-22T21:57:10.799Z (22 days ago)
- Topics: condition, map, next, where
- Language: JavaScript
- Homepage:
- Size: 14.6 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# next-where
> Get collection items from condition map.[![version][version-image]][version-url]
[![license][license-image]][license-url]
[![size][size-image]][size-url]
[![download][download-image]][download-url]## installation
```bash
npm install -S @jswork/next-where
```## usage
```js
import '@jswork/next-where';const data = [
{
id: 67,
userId: 'EB1347950628',
goods: {
type: 1,
country: 'Panama',
year: 2014,
keywords: 'tes',
field: null,
infoNumber: 262,
title: '数据查询(Panama2014)',
price: 0.02
},
title: '数据查询(Panama2014)'
},
{
id: 68,
userId: 'EB1347950628-2',
goods: {
type: 1,
country: 'Panama',
year: 2014,
keywords: 'tes',
field: null,
infoNumber: 262,
title: '数据查询(Panama2014)',
price: 0.01
},
title: '数据查询(Panama2014)'
},
{
id: 69,
userId: 'EB1347950628',
goods: {
type: 2,
country: 'Panama',
year: 2015,
keywords: 'test',
field: null,
infoNumber: 780,
title: '数据查询(Panama2015)',
price: 0.01
},
title: '数据查询(Panama2015)'
}
];// filter by map condition
nx.where(data, { id: 67 });// result
[
{
id: 67,
userId: 'EB1347950628',
goods: {
type: 1,
country: 'Panama',
year: 2014,
keywords: 'tes',
field: null,
infoNumber: 262,
title: '数据查询(Panama2014)',
price: 0.02
},
title: '数据查询(Panama2014)'
}
]
```## license
Code released under [the MIT license](https://github.com/afeiship/next-where/blob/master/LICENSE.txt).[version-image]: https://img.shields.io/npm/v/@jswork/next-where
[version-url]: https://npmjs.org/package/@jswork/next-where[license-image]: https://img.shields.io/npm/l/@jswork/next-where
[license-url]: https://github.com/afeiship/next-where/blob/master/LICENSE.txt[size-image]: https://img.shields.io/bundlephobia/minzip/@jswork/next-where
[size-url]: https://github.com/afeiship/next-where/blob/master/dist/next-where.min.js[download-image]: https://img.shields.io/npm/dm/@jswork/next-where
[download-url]: https://www.npmjs.com/package/@jswork/next-where