執行復雜JavaScript對象搜索的查詢語言:queryl
Queryl能夠實現構建復雜的查詢來匹配JavaScript對象。它可用于:
- 搜索對象集合 (甚至是heterogeneus).
- 驗證對象。
- Assert properties of an object for testing purposes.
Check the FAQ for answers to common questions!
Installation
Installquerylby running:
$ npm install --save queryl
Documentation
queryl.match(query, object) ?Boolean
Kind: static method ofqueryl
Summary: Query an object
Returns:Boolean- whether it matches or not
Access: public
Param | Type | Description |
---|---|---|
query | Object | query |
object | Object | object |
Example
queryl.match({ $or: { $equal: { foo: 'bar' }, $and: { $not: { $match: { foo: /^baz/ } }, $gt: { bar: 3 } } } }, { foo: 'hello world', bar: 5 }); > true
本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!