Skip to content

Commit 61207eb

Browse files
committed
add safe eval for browser and evalType option
update test html file to use compiled module update demo html file to include sample & prevent submit
1 parent 55e7728 commit 61207eb

19 files changed

+3621
-61
lines changed

.eslintignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
node_modules
2-
dist
1+
node_modules/
2+
dist/
33
docs/ts
44
coverage
55
ignore
66
!*.js
7+
!.config.js

.eslintrc.cjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ module.exports = {
1717
'XMLHttpRequest'
1818
]
1919
},
20+
parser: '@babel/eslint-parser',
2021
overrides: [
2122
{
2223
files: ['src/jsonpath-node.js', 'test-helpers/node-env.js'],
File renamed without changes.

demo/index.html

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,52 @@
99
<body>
1010
<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>
1111
</h2>
12-
<form>
12+
<form onsubmit="return false">
1313
<div>
1414
<label><b>JSONPath:</b>
15-
<input id="jsonpath" placeholder="$.books" />
15+
<input type="text" id="jsonpath" placeholder="$.books" value="$..book[?(@parent.bicycle && @parent.bicycle.color === &quot;red&quot;)].category" />
1616
</label>
1717
</div>
1818
<div id="jsonSampleContainer" class="container">
1919
<label><b>JSON sample:</b>
20-
<textarea id="jsonSample" placeholder="{&quot;books&quot;: []}"></textarea>
20+
<textarea id="jsonSample" placeholder="{&quot;books&quot;: []}">
21+
{
22+
"store": {
23+
"book": [
24+
{
25+
"category": "reference",
26+
"author": "Nigel Rees",
27+
"title": "Sayings of the Century",
28+
"price": 8.95
29+
},
30+
{
31+
"category": "fiction",
32+
"author": "Evelyn Waugh",
33+
"title": "Sword of Honour",
34+
"price": 12.99
35+
},
36+
{
37+
"category": "fiction",
38+
"author": "Herman Melville",
39+
"title": "Moby Dick",
40+
"isbn": "0-553-21311-3",
41+
"price": 8.99
42+
},
43+
{
44+
"category": "fiction",
45+
"author": "J. R. R. Tolkien",
46+
"title": "The Lord of the Rings",
47+
"isbn": "0-395-19395-8",
48+
"price": 22.99
49+
}
50+
],
51+
"bicycle": {
52+
"color": "red",
53+
"price": 19.95
54+
}
55+
}
56+
}
57+
</textarea>
2158
</label>
2259
</div>
2360
<div id="resultContainer" class="container">

0 commit comments

Comments
 (0)