Skip to content

Commit 7a2140b

Browse files
committed
- Build: Update
- Linting: User ES2020 ecmaVersion over `babel-eslint` (dynamic as well as static `import`) - Linting: As per latest - Docs: Avoid external docs and bundle with repo (allowing use on Github Pages; still ignored from npm releases) - npm: Add linting and typescript checking to `test` script; rename test-cov to nyc - npm: Update devDeps.
1 parent 2bf718a commit 7a2140b

29 files changed

Lines changed: 7100 additions & 1297 deletions

.eslintrc.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
'use strict';
22
module.exports = {
33
'extends': ['ash-nazg/sauron-node'],
4-
parser: 'babel-eslint',
4+
parserOptions: {
5+
ecmaVersion: 2020,
6+
sourceType: 'module'
7+
},
58
'settings': {
69
'polyfills': [
710
'Array.isArray',

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,4 @@ pids
77
reports
88
target
99
*.log
10-
docs/ts
1110
coverage

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@ the callback function being executed 0 to N times depending
131131
on the number of independent items to be found in the result.
132132
See the docs below for more on `JSONPath`'s available arguments.
133133

134+
See also the [API docs](https://jsonpath-plus.github.io/JSONPath/docs/ts/).
135+
134136
### Properties
135137

136138
The properties that can be supplied on the options object or

dist/index-es.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -412,8 +412,8 @@ var NewError = /*#__PURE__*/function (_Error) {
412412
* @typedef {PlainObject} JSONPathOptions
413413
* @property {JSON} json
414414
* @property {string|string[]} path
415-
* @property {"value"|"path"|"pointer"|"parent"|"parentProperty"|"all"}
416-
* [resultType="value"]
415+
* @property {"value"|"path"|"pointer"|"parent"|
416+
* "parentProperty"|"all"} [resultType="value"]
417417
* @property {boolean} [flatten=false]
418418
* @property {boolean} [wrap=true]
419419
* @property {PlainObject} [sandbox={}]
@@ -591,9 +591,6 @@ JSONPath.prototype._getPreferredOutput = function (ea) {
591591
var resultType = this.currResultType;
592592

593593
switch (resultType) {
594-
default:
595-
throw new TypeError('Unknown result type');
596-
597594
case 'all':
598595
{
599596
var path = Array.isArray(ea.path) ? ea.path : JSONPath.toPathArray(ea.path);
@@ -612,6 +609,9 @@ JSONPath.prototype._getPreferredOutput = function (ea) {
612609

613610
case 'pointer':
614611
return JSONPath.toPointer(ea.path);
612+
613+
default:
614+
throw new TypeError('Unknown result type');
615615
}
616616
};
617617

@@ -759,10 +759,6 @@ JSONPath.prototype._trace = function (expr, val, path, parent, parentPropName, c
759759
var valueType = loc.slice(1, -2);
760760

761761
switch (valueType) {
762-
/* istanbul ignore next */
763-
default:
764-
throw new TypeError('Unknown value type ' + valueType);
765-
766762
case 'scalar':
767763
if (!val || !['object', 'function'].includes(_typeof(val))) {
768764
addType = true;
@@ -827,6 +823,11 @@ JSONPath.prototype._trace = function (expr, val, path, parent, parentPropName, c
827823
}
828824

829825
break;
826+
827+
/* istanbul ignore next */
828+
829+
default:
830+
throw new TypeError('Unknown value type ' + valueType);
830831
}
831832

832833
if (addType) {

dist/index-es.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index-es.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index-umd.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -418,8 +418,8 @@
418418
* @typedef {PlainObject} JSONPathOptions
419419
* @property {JSON} json
420420
* @property {string|string[]} path
421-
* @property {"value"|"path"|"pointer"|"parent"|"parentProperty"|"all"}
422-
* [resultType="value"]
421+
* @property {"value"|"path"|"pointer"|"parent"|
422+
* "parentProperty"|"all"} [resultType="value"]
423423
* @property {boolean} [flatten=false]
424424
* @property {boolean} [wrap=true]
425425
* @property {PlainObject} [sandbox={}]
@@ -597,9 +597,6 @@
597597
var resultType = this.currResultType;
598598

599599
switch (resultType) {
600-
default:
601-
throw new TypeError('Unknown result type');
602-
603600
case 'all':
604601
{
605602
var path = Array.isArray(ea.path) ? ea.path : JSONPath.toPathArray(ea.path);
@@ -618,6 +615,9 @@
618615

619616
case 'pointer':
620617
return JSONPath.toPointer(ea.path);
618+
619+
default:
620+
throw new TypeError('Unknown result type');
621621
}
622622
};
623623

@@ -765,10 +765,6 @@
765765
var valueType = loc.slice(1, -2);
766766

767767
switch (valueType) {
768-
/* istanbul ignore next */
769-
default:
770-
throw new TypeError('Unknown value type ' + valueType);
771-
772768
case 'scalar':
773769
if (!val || !['object', 'function'].includes(_typeof(val))) {
774770
addType = true;
@@ -833,6 +829,11 @@
833829
}
834830

835831
break;
832+
833+
/* istanbul ignore next */
834+
835+
default:
836+
throw new TypeError('Unknown value type ' + valueType);
836837
}
837838

838839
if (addType) {

dist/index-umd.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index-umd.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)