Update to v13 and add queue and completely change code
This commit is contained in:
parent
dcef23d0ed
commit
55a38726a3
6706 changed files with 424137 additions and 61608 deletions
19
node_modules/jsonpath-plus/demo/index.css
generated
vendored
Normal file
19
node_modules/jsonpath-plus/demo/index.css
generated
vendored
Normal file
|
@ -0,0 +1,19 @@
|
|||
#jsonpath {
|
||||
width: 90%;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.container {
|
||||
float: left;
|
||||
width: 48%;
|
||||
}
|
||||
|
||||
.container textarea {
|
||||
margin: 2%;
|
||||
width: 98%;
|
||||
height: 565px;
|
||||
}
|
||||
|
||||
#demoNode {
|
||||
font-size: small;
|
||||
}
|
32
node_modules/jsonpath-plus/demo/index.html
generated
vendored
Normal file
32
node_modules/jsonpath-plus/demo/index.html
generated
vendored
Normal file
|
@ -0,0 +1,32 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en" dir="ltr">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>JSONPath Demo</title>
|
||||
<link rel="shortcut icon" href="data:image/x-icon;," type="image/x-icon" />
|
||||
<link rel="stylesheet" href="index.css" />
|
||||
</head>
|
||||
<body>
|
||||
<h2>JSONPath Demo <i id="demoNode">(To demo on Node instead, see the <a href="https://npm.runkit.com/jsonpath-plus">library on Runkit</a>.)</i>
|
||||
</h2>
|
||||
<form>
|
||||
<div>
|
||||
<label><b>JSONPath:</b>
|
||||
<input id="jsonpath" placeholder="$.books" />
|
||||
</label>
|
||||
</div>
|
||||
<div id="jsonSampleContainer" class="container">
|
||||
<label><b>JSON sample:</b>
|
||||
<textarea id="jsonSample" placeholder="{"books": []}"></textarea>
|
||||
</label>
|
||||
</div>
|
||||
<div id="resultContainer" class="container">
|
||||
<label><b>Results:</b>
|
||||
<textarea id="results"></textarea>
|
||||
</label>
|
||||
</div>
|
||||
</form>
|
||||
<script src="../dist/index-browser-umd.js"></script>
|
||||
<script src="index.js"></script>
|
||||
</body>
|
||||
</html>
|
48
node_modules/jsonpath-plus/demo/index.js
generated
vendored
Normal file
48
node_modules/jsonpath-plus/demo/index.js
generated
vendored
Normal file
|
@ -0,0 +1,48 @@
|
|||
/* globals JSONPath */
|
||||
/* eslint-disable import/unambiguous */
|
||||
|
||||
// Todo: Extract testing example paths/contents and use for a
|
||||
// pulldown that can populate examples
|
||||
|
||||
// Todo: Make configurable with other JSONPath options
|
||||
|
||||
// Todo: Allow source to be treated as an (evaled) JSON object
|
||||
|
||||
// Todo: Could add JSON/JS syntax highlighting in sample and result,
|
||||
// ideally with a jsonpath-plus parser highlighter as well
|
||||
|
||||
const $ = (s) => document.querySelector(s);
|
||||
|
||||
const updateResults = () => {
|
||||
const jsonSample = $('#jsonSample');
|
||||
const reportValidity = () => {
|
||||
// Doesn't work without a timeout
|
||||
setTimeout(() => {
|
||||
jsonSample.reportValidity();
|
||||
});
|
||||
};
|
||||
let json;
|
||||
try {
|
||||
json = JSON.parse(jsonSample.value);
|
||||
jsonSample.setCustomValidity('');
|
||||
reportValidity();
|
||||
} catch (err) {
|
||||
jsonSample.setCustomValidity('Error parsing JSON: ' + err.toString());
|
||||
reportValidity();
|
||||
return;
|
||||
}
|
||||
const result = JSONPath.JSONPath({
|
||||
path: $('#jsonpath').value,
|
||||
json
|
||||
});
|
||||
|
||||
$('#results').value = JSON.stringify(result, null, 2);
|
||||
};
|
||||
|
||||
$('#jsonpath').addEventListener('input', () => {
|
||||
updateResults();
|
||||
});
|
||||
|
||||
$('#jsonSample').addEventListener('input', () => {
|
||||
updateResults();
|
||||
});
|
46
node_modules/jsonpath-plus/demo/node-import-test.mjs
generated
vendored
Normal file
46
node_modules/jsonpath-plus/demo/node-import-test.mjs
generated
vendored
Normal file
|
@ -0,0 +1,46 @@
|
|||
import {JSONPath} from '../dist/index-node-esm.mjs';
|
||||
|
||||
/* eslint-disable quotes, quote-props */
|
||||
const json = {
|
||||
"store": {
|
||||
"book": [{
|
||||
"category": "reference",
|
||||
"author": "Nigel Rees",
|
||||
"title": "Sayings of the Century",
|
||||
"price": 8.95
|
||||
},
|
||||
{
|
||||
"category": "fiction",
|
||||
"author": "Evelyn Waugh",
|
||||
"title": "Sword of Honour",
|
||||
"price": 12.99
|
||||
},
|
||||
{
|
||||
"category": "fiction",
|
||||
"author": "Herman Melville",
|
||||
"title": "Moby Dick",
|
||||
"isbn": "0-553-21311-3",
|
||||
"price": 8.99
|
||||
},
|
||||
{
|
||||
"category": "fiction",
|
||||
"author": "J. R. R. Tolkien",
|
||||
"title": "The Lord of the Rings",
|
||||
"isbn": "0-395-19395-8",
|
||||
"price": 22.99
|
||||
}],
|
||||
"bicycle": {
|
||||
"color": "red",
|
||||
"price": 19.95
|
||||
}
|
||||
}
|
||||
};
|
||||
/* eslint-enable quotes, quote-props */
|
||||
|
||||
const result = JSONPath({
|
||||
json,
|
||||
path: '$.store.book[*].author'
|
||||
});
|
||||
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('result', result);
|
Loading…
Add table
Add a link
Reference in a new issue