Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jsqry/jsqry
Simple JS lib to query js objects/arrays
https://github.com/jsqry/jsqry
filter json json-query query transform
Last synced: 4 days ago
JSON representation
Simple JS lib to query js objects/arrays
- Host: GitHub
- URL: https://github.com/jsqry/jsqry
- Owner: jsqry
- License: mit
- Created: 2016-04-27T21:15:03.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2023-03-04T23:49:05.000Z (over 1 year ago)
- Last Synced: 2024-09-20T07:09:30.872Z (about 2 months ago)
- Topics: filter, json, json-query, query, transform
- Language: JavaScript
- Homepage: https://jsqry.github.io
- Size: 298 KB
- Stars: 46
- Watchers: 4
- Forks: 3
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![Stand With Ukraine](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner-direct-single.svg)](https://stand-with-ukraine.pp.ua)
# jsqry
[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/xonixx/jsqry/master/LICENSE)
[![npm](https://img.shields.io/npm/v/jsqry.svg)](https://www.npmjs.com/package/jsqry)
[![Coverage Status](https://coveralls.io/repos/github/jsqry/jsqry/badge.svg?branch=master)](https://coveralls.io/github/jsqry/jsqry?branch=master)Simple lib to query JS objects/arrays.
This tiny lib allows to query JS object/arrays in one-liner fashion instead of writing tedious loops (possibly nested).
Before:
```javascript
var name;
for (var i = 0; i < users.length; i++) {
if (users[i].id == 123) {
name = users[i].name;
break;
}
}
```After:
```javascript
var name = first(users, '[_.id==?].name', 123);
```Features include:
* Filtering
* Mapping
* Python-style array indexing & slicing
* [lot more!](https://jsqry.github.io/)## Documentation
For docs and examples please visit [jsqry.github.io](https://jsqry.github.io/).
## Install
#### Nodejs
```bash
npm install jsqry
```or
```bash
yarn add jsqry
```#### Web
```html
```