Send to zulip

This commit is contained in:
Koper
2023-11-20 21:39:33 +07:00
parent 82f50817f8
commit ba40d28152
3609 changed files with 2311843 additions and 7 deletions

View File

@@ -0,0 +1,13 @@
Copyright 2014 James Saryerwinnie
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@@ -0,0 +1,57 @@
# jmespath.js
[![Build Status](https://travis-ci.org/jmespath/jmespath.js.png?branch=master)](https://travis-ci.org/jmespath/jmespath.js)
jmespath.js is a javascript implementation of JMESPath,
which is a query language for JSON. It will take a JSON
document and transform it into another JSON document
through a JMESPath expression.
Using jmespath.js is really easy. There's a single function
you use, `jmespath.search`:
```
> var jmespath = require('jmespath');
> jmespath.search({foo: {bar: {baz: [0, 1, 2, 3, 4]}}}, "foo.bar.baz[2]")
2
```
In the example we gave the ``search`` function input data of
`{foo: {bar: {baz: [0, 1, 2, 3, 4]}}}` as well as the JMESPath
expression `foo.bar.baz[2]`, and the `search` function evaluated
the expression against the input data to produce the result ``2``.
The JMESPath language can do a lot more than select an element
from a list. Here are a few more examples:
```
> jmespath.search({foo: {bar: {baz: [0, 1, 2, 3, 4]}}}, "foo.bar")
{ baz: [ 0, 1, 2, 3, 4 ] }
> jmespath.search({"foo": [{"first": "a", "last": "b"},
{"first": "c", "last": "d"}]},
"foo[*].first")
[ 'a', 'c' ]
> jmespath.search({"foo": [{"age": 20}, {"age": 25},
{"age": 30}, {"age": 35},
{"age": 40}]},
"foo[?age > `30`]")
[ { age: 35 }, { age: 40 } ]
```
## More Resources
The example above only show a small amount of what
a JMESPath expression can do. If you want to take a
tour of the language, the *best* place to go is the
[JMESPath Tutorial](http://jmespath.org/tutorial.html).
One of the best things about JMESPath is that it is
implemented in many different programming languages including
python, ruby, php, lua, etc. To see a complete list of libraries,
check out the [JMESPath libraries page](http://jmespath.org/libraries.html).
And finally, the full JMESPath specification can be found
on the [JMESPath site](http://jmespath.org/specification.html).

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,24 @@
{
"name": "jmespath.js",
"main": "jmespath.js",
"version": "0.11.0",
"homepage": "https://github.com/jmespath/jmespath.js",
"authors": [
"James Saryerwinnie <js@jamesls.com>"
],
"description": "JMESPath implementation in javascript",
"moduleType": [
"node"
],
"keywords": [
"jmespath"
],
"license": "MIT",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
]
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,23 @@
#!/usr/bin/env node
jmespath = require('./jmespath');
process.stdin.setEncoding('utf-8');
if (process.argv.length < 2) {
console.log("Must provide a jmespath expression.");
process.exit(1);
}
var inputJSON = "";
process.stdin.on('readable', function() {
var chunk = process.stdin.read();
if (chunk !== null) {
inputJSON += chunk;
}
});
process.stdin.on('end', function() {
var parsedInput = JSON.parse(inputJSON);
console.log(JSON.stringify(jmespath.search(parsedInput, process.argv[2])));
});

View File

@@ -0,0 +1,45 @@
{
"name": "jmespath",
"description": "JMESPath implementation in javascript",
"version": "0.16.0",
"author": {
"name": "James Saryerwinnie",
"email": "js@jamesls.com",
"url": "http://jamesls.com/"
},
"homepage": "https://github.com/jmespath/jmespath.js",
"contributors": [],
"devDependencies": {
"grunt": "^0.4.5",
"grunt-contrib-jshint": "^0.11.0",
"grunt-contrib-uglify": "^0.11.1",
"grunt-eslint": "^17.3.1",
"mocha": "^2.1.0"
},
"dependencies": {},
"main": "jmespath.js",
"directories": {
"test": "test"
},
"engines": {
"node": ">= 0.6.0"
},
"repository": {
"type": "git",
"url": "git://github.com/jmespath/jmespath.js"
},
"bugs": {
"url": "http://github.com/jmespath/jmespath.js/issues",
"mail": ""
},
"license": "Apache-2.0",
"keywords": [
"jmespath",
"jsonpath",
"json",
"xpath"
],
"scripts": {
"test": "mocha test/"
}
}