Skip to content

Commit

Permalink
add safe eval for browser and evalType option
Browse files Browse the repository at this point in the history
update test html file to use compiled module

update demo html file to include sample & prevent submit
  • Loading branch information
80avin committed Dec 23, 2022
1 parent 55e7728 commit 61207eb
Show file tree
Hide file tree
Showing 19 changed files with 3,621 additions and 61 deletions.
5 changes: 3 additions & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
node_modules
dist
node_modules/
dist/
docs/ts
coverage
ignore
!*.js
!.config.js
1 change: 1 addition & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ module.exports = {
'XMLHttpRequest'
]
},
parser: '@babel/eslint-parser',
overrides: [
{
files: ['src/jsonpath-node.js', 'test-helpers/node-env.js'],
Expand Down
File renamed without changes.
43 changes: 40 additions & 3 deletions demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,52 @@
<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>
<form onsubmit="return false">
<div>
<label><b>JSONPath:</b>
<input id="jsonpath" placeholder="$.books" />
<input type="text" id="jsonpath" placeholder="$.books" value="$..book[?(@parent.bicycle && @parent.bicycle.color === &quot;red&quot;)].category" />
</label>
</div>
<div id="jsonSampleContainer" class="container">
<label><b>JSON sample:</b>
<textarea id="jsonSample" placeholder="{&quot;books&quot;: []}"></textarea>
<textarea id="jsonSample" placeholder="{&quot;books&quot;: []}">
{
"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
}
}
}
</textarea>
</label>
</div>
<div id="resultContainer" class="container">
Expand Down
Loading

0 comments on commit 61207eb

Please sign in to comment.