Skip to content

Commit a83db77

Browse files
committed
chore: update devDeps. and lint accordingly
1 parent 2f92afc commit a83db77

15 files changed

+1228
-902
lines changed

.eslintrc.cjs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ module.exports = {
2929
sourceType: 'module'
3030
},
3131
rules: {
32-
'node/no-unsupported-features/es-syntax': ['error', {
32+
'n/no-unsupported-features/es-syntax': ['error', {
3333
ignores: [
3434
'regexpNamedCaptureGroups', 'modules', 'dynamicImport'
3535
]
@@ -52,18 +52,18 @@ module.exports = {
5252
varsIgnorePattern: 'json|result'
5353
}],
5454
'import/no-extraneous-dependencies': 0,
55-
'node/no-extraneous-import': ['error', {
55+
'n/no-extraneous-import': ['error', {
5656
allowModules: ['jsonpath-plus']
5757
}],
58-
'node/no-missing-require': ['error', {
58+
'n/no-missing-require': ['error', {
5959
allowModules: ['jsonpath-plus']
6060
}],
6161
// Unfortunately, with the new processor approach, the filename
6262
// is now README.md so our paths must be `../`. However, even
6363
// with that, eslint-plugin-node is not friendly to such
6464
// imports, so we disable
65-
'node/no-missing-import': 'off',
66-
'node/no-unpublished-import': 'off'
65+
'n/no-missing-import': 'off',
66+
'n/no-unpublished-import': 'off'
6767
}
6868
},
6969
{

dist/index-browser-esm.js

Lines changed: 30 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -52,18 +52,17 @@ function _inherits(subClass, superClass) {
5252
}
5353

5454
function _getPrototypeOf(o) {
55-
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
55+
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
5656
return o.__proto__ || Object.getPrototypeOf(o);
5757
};
5858
return _getPrototypeOf(o);
5959
}
6060

6161
function _setPrototypeOf(o, p) {
62-
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
62+
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
6363
o.__proto__ = p;
6464
return o;
6565
};
66-
6766
return _setPrototypeOf(o, p);
6867
}
6968

@@ -82,7 +81,7 @@ function _isNativeReflectConstruct() {
8281

8382
function _construct(Parent, args, Class) {
8483
if (_isNativeReflectConstruct()) {
85-
_construct = Reflect.construct;
84+
_construct = Reflect.construct.bind();
8685
} else {
8786
_construct = function _construct(Parent, args, Class) {
8887
var a = [null];
@@ -264,13 +263,21 @@ function _createForOfIteratorHelper(o, allowArrayLike) {
264263

265264
var hasOwnProp = Object.prototype.hasOwnProperty;
266265
/**
267-
* @typedef {null|boolean|number|string|PlainObject|GenericArray} JSONObject
268-
*/
266+
* @typedef {null|boolean|number|string|PlainObject|GenericArray} JSONObject
267+
*/
268+
269+
/**
270+
* @typedef {any} AnyItem
271+
*/
272+
273+
/**
274+
* @typedef {any} AnyResult
275+
*/
269276

270277
/**
271278
* Copies array and then pushes item into it.
272279
* @param {GenericArray} arr Array to copy and into which to push
273-
* @param {any} item Array item to add (to end)
280+
* @param {AnyItem} item Array item to add (to end)
274281
* @returns {GenericArray} Copy of the original array
275282
*/
276283

@@ -281,7 +288,7 @@ function push(arr, item) {
281288
}
282289
/**
283290
* Copies array and then unshifts item into it.
284-
* @param {any} item Array item to add (to beginning)
291+
* @param {AnyItem} item Array item to add (to beginning)
285292
* @param {GenericArray} arr Array to copy and into which to unshift
286293
* @returns {GenericArray} Copy of the original array
287294
*/
@@ -304,7 +311,7 @@ var NewError = /*#__PURE__*/function (_Error) {
304311
var _super = _createSuper(NewError);
305312

306313
/**
307-
* @param {any} value The evaluated scalar value
314+
* @param {AnyResult} value The evaluated scalar value
308315
*/
309316
function NewError(value) {
310317
var _this;
@@ -559,7 +566,7 @@ JSONPath.prototype._handleCallback = function (fullRetObj, callback, type) {
559566
if (callback) {
560567
var preferredOutput = this._getPreferredOutput(fullRetObj);
561568

562-
fullRetObj.path = typeof fullRetObj.path === 'string' ? fullRetObj.path : JSONPath.toPathString(fullRetObj.path); // eslint-disable-next-line node/callback-return
569+
fullRetObj.path = typeof fullRetObj.path === 'string' ? fullRetObj.path : JSONPath.toPathString(fullRetObj.path); // eslint-disable-next-line n/callback-return
563570

564571
callback(preferredOutput, type, fullRetObj);
565572
}
@@ -915,8 +922,6 @@ JSONPath.prototype._eval = function (code, _v, _vname, path, parent, parentPropN
915922
try {
916923
return this.vm.runInNewContext(code, this.currSandbox);
917924
} catch (e) {
918-
// eslint-disable-next-line no-console
919-
console.log(e);
920925
throw new Error('jsonPath: ' + e.message + ': ' + code);
921926
}
922927
}; // PUBLIC CLASS PROPERTIES AND METHODS
@@ -1002,10 +1007,18 @@ JSONPath.toPathArray = function (expr) {
10021007
};
10031008

10041009
/**
1005-
* @callback ConditionCallback
1006-
* @param {any} item
1007-
* @returns {boolean}
1008-
*/
1010+
* @typedef {any} ContextItem
1011+
*/
1012+
1013+
/**
1014+
* @typedef {any} EvaluatedResult
1015+
*/
1016+
1017+
/**
1018+
* @callback ConditionCallback
1019+
* @param {ContextItem} item
1020+
* @returns {boolean}
1021+
*/
10091022

10101023
/**
10111024
* Copy items out of one array into another.
@@ -1033,7 +1046,7 @@ JSONPath.prototype.vm = {
10331046
* @param {string} expr Expression to evaluate
10341047
* @param {PlainObject} context Object whose items will be added
10351048
* to evaluation
1036-
* @returns {any} Result of evaluated code
1049+
* @returns {EvaluatedResult} Result of evaluated code
10371050
*/
10381051
runInNewContext: function runInNewContext(expr, context) {
10391052
var keys = Object.keys(context);

dist/index-browser-esm.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-browser-esm.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-browser-umd.cjs

Lines changed: 30 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -58,18 +58,17 @@
5858
}
5959

6060
function _getPrototypeOf(o) {
61-
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
61+
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
6262
return o.__proto__ || Object.getPrototypeOf(o);
6363
};
6464
return _getPrototypeOf(o);
6565
}
6666

6767
function _setPrototypeOf(o, p) {
68-
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
68+
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
6969
o.__proto__ = p;
7070
return o;
7171
};
72-
7372
return _setPrototypeOf(o, p);
7473
}
7574

@@ -88,7 +87,7 @@
8887

8988
function _construct(Parent, args, Class) {
9089
if (_isNativeReflectConstruct()) {
91-
_construct = Reflect.construct;
90+
_construct = Reflect.construct.bind();
9291
} else {
9392
_construct = function _construct(Parent, args, Class) {
9493
var a = [null];
@@ -270,13 +269,21 @@
270269

271270
var hasOwnProp = Object.prototype.hasOwnProperty;
272271
/**
273-
* @typedef {null|boolean|number|string|PlainObject|GenericArray} JSONObject
274-
*/
272+
* @typedef {null|boolean|number|string|PlainObject|GenericArray} JSONObject
273+
*/
274+
275+
/**
276+
* @typedef {any} AnyItem
277+
*/
278+
279+
/**
280+
* @typedef {any} AnyResult
281+
*/
275282

276283
/**
277284
* Copies array and then pushes item into it.
278285
* @param {GenericArray} arr Array to copy and into which to push
279-
* @param {any} item Array item to add (to end)
286+
* @param {AnyItem} item Array item to add (to end)
280287
* @returns {GenericArray} Copy of the original array
281288
*/
282289

@@ -287,7 +294,7 @@
287294
}
288295
/**
289296
* Copies array and then unshifts item into it.
290-
* @param {any} item Array item to add (to beginning)
297+
* @param {AnyItem} item Array item to add (to beginning)
291298
* @param {GenericArray} arr Array to copy and into which to unshift
292299
* @returns {GenericArray} Copy of the original array
293300
*/
@@ -310,7 +317,7 @@
310317
var _super = _createSuper(NewError);
311318

312319
/**
313-
* @param {any} value The evaluated scalar value
320+
* @param {AnyResult} value The evaluated scalar value
314321
*/
315322
function NewError(value) {
316323
var _this;
@@ -565,7 +572,7 @@
565572
if (callback) {
566573
var preferredOutput = this._getPreferredOutput(fullRetObj);
567574

568-
fullRetObj.path = typeof fullRetObj.path === 'string' ? fullRetObj.path : JSONPath.toPathString(fullRetObj.path); // eslint-disable-next-line node/callback-return
575+
fullRetObj.path = typeof fullRetObj.path === 'string' ? fullRetObj.path : JSONPath.toPathString(fullRetObj.path); // eslint-disable-next-line n/callback-return
569576

570577
callback(preferredOutput, type, fullRetObj);
571578
}
@@ -921,8 +928,6 @@
921928
try {
922929
return this.vm.runInNewContext(code, this.currSandbox);
923930
} catch (e) {
924-
// eslint-disable-next-line no-console
925-
console.log(e);
926931
throw new Error('jsonPath: ' + e.message + ': ' + code);
927932
}
928933
}; // PUBLIC CLASS PROPERTIES AND METHODS
@@ -1008,10 +1013,18 @@
10081013
};
10091014

10101015
/**
1011-
* @callback ConditionCallback
1012-
* @param {any} item
1013-
* @returns {boolean}
1014-
*/
1016+
* @typedef {any} ContextItem
1017+
*/
1018+
1019+
/**
1020+
* @typedef {any} EvaluatedResult
1021+
*/
1022+
1023+
/**
1024+
* @callback ConditionCallback
1025+
* @param {ContextItem} item
1026+
* @returns {boolean}
1027+
*/
10151028

10161029
/**
10171030
* Copy items out of one array into another.
@@ -1039,7 +1052,7 @@
10391052
* @param {string} expr Expression to evaluate
10401053
* @param {PlainObject} context Object whose items will be added
10411054
* to evaluation
1042-
* @returns {any} Result of evaluated code
1055+
* @returns {EvaluatedResult} Result of evaluated code
10431056
*/
10441057
runInNewContext: function runInNewContext(expr, context) {
10451058
var keys = Object.keys(context);

0 commit comments

Comments
 (0)