Skip to content

Commit a2b663e

Browse files
committed
- Update: Build as per refactoring
- Docs: Update as per typedoc update - Linting: As per latest ash-nazg - npm: Update devDeps. - npm: Bump to 5.0.3
1 parent 3b60ae3 commit a2b663e

22 files changed

+11522
-748
lines changed

CHANGES.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# CHANGES for jsonpath-plus
22

3+
## 5.0.3 (2021-02-06)
4+
5+
- Fix: Add package exports for browser and umd (#145) (@gjvoosten)
6+
- Update: Build as per refactoring
7+
- Docs: Update as per typedoc update
8+
- Linting: As per latest ash-nazg
9+
- npm: Update devDeps.
10+
311
## 5.0.2 (2021-01-15)
412

513
- Fix: Proper Node CommonJS export; fixes #144

dist/index-browser-esm.js

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,8 @@ function _createForOfIteratorHelper(o, allowArrayLike) {
244244
};
245245
}
246246

247+
/* eslint-disable unicorn/prefer-spread -- IIRC, Babel's performance
248+
with this not good */
247249
var hasOwnProp = Object.prototype.hasOwnProperty;
248250
/**
249251
* @typedef {null|boolean|number|string|PlainObject|GenericArray} JSONObject
@@ -427,7 +429,8 @@ function JSONPath(opts, expr, obj, callback, otherTypeCallback) {
427429

428430

429431
JSONPath.prototype.evaluate = function (expr, json, callback, otherTypeCallback) {
430-
var that = this;
432+
var _this2 = this;
433+
431434
var currParent = this.parent,
432435
currParentProperty = this.parentProperty;
433436
var flatten = this.flatten,
@@ -496,7 +499,7 @@ JSONPath.prototype.evaluate = function (expr, json, callback, otherTypeCallback)
496499
}
497500

498501
return result.reduce(function (rslt, ea) {
499-
var valOrPath = that._getPreferredOutput(ea);
502+
var valOrPath = _this2._getPreferredOutput(ea);
500503

501504
if (flatten && Array.isArray(valOrPath)) {
502505
rslt = rslt.concat(valOrPath);
@@ -561,10 +564,11 @@ JSONPath.prototype._handleCallback = function (fullRetObj, callback, type) {
561564

562565

563566
JSONPath.prototype._trace = function (expr, val, path, parent, parentPropName, callback, hasArrExpr, literalPriority) {
567+
var _this3 = this;
568+
564569
// No expr to follow? return path and value as the result of
565570
// this trace branch
566571
var retObj;
567-
var that = this;
568572

569573
if (!expr.length) {
570574
retObj = {
@@ -610,7 +614,7 @@ JSONPath.prototype._trace = function (expr, val, path, parent, parentPropName, c
610614
} else if (loc === '*') {
611615
// all child properties
612616
this._walk(loc, x, val, path, parent, parentPropName, callback, function (m, l, _x, v, p, par, pr, cb) {
613-
addRet(that._trace(unshift(m, _x), v, p, par, pr, cb, true, true));
617+
addRet(_this3._trace(unshift(m, _x), v, p, par, pr, cb, true, true));
614618
});
615619
} else if (loc === '..') {
616620
// all descendent parent properties
@@ -623,7 +627,7 @@ JSONPath.prototype._trace = function (expr, val, path, parent, parentPropName, c
623627
if (_typeof(v[m]) === 'object') {
624628
// Keep going with recursive descent on val's
625629
// object children
626-
addRet(that._trace(unshift(l, _x), v[m], push(p, m), v, m, cb, true));
630+
addRet(_this3._trace(unshift(l, _x), v[m], push(p, m), v, m, cb, true));
627631
}
628632
}); // The parent sel computation is handled in the frame above using the
629633
// ancestor object of val
@@ -661,8 +665,8 @@ JSONPath.prototype._trace = function (expr, val, path, parent, parentPropName, c
661665
}
662666

663667
this._walk(loc, x, val, path, parent, parentPropName, callback, function (m, l, _x, v, p, par, pr, cb) {
664-
if (that._eval(l.replace(/^\?\(((?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?)\)$/, '$1'), v[m], m, p, par, pr)) {
665-
addRet(that._trace(unshift(m, _x), v, p, par, pr, cb, true));
668+
if (_this3._eval(l.replace(/^\?\(((?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?)\)$/, '$1'), v[m], m, p, par, pr)) {
669+
addRet(_this3._trace(unshift(m, _x), v, p, par, pr, cb, true));
666670
}
667671
});
668672
} else if (loc[0] === '(') {
@@ -798,7 +802,7 @@ JSONPath.prototype._trace = function (expr, val, path, parent, parentPropName, c
798802
var rett = ret[t];
799803

800804
if (rett && rett.isParentSelector) {
801-
var tmp = that._trace(rett.expr, val, rett.path, parent, parentPropName, callback, hasArrExpr);
805+
var tmp = this._trace(rett.expr, val, rett.path, parent, parentPropName, callback, hasArrExpr);
802806

803807
if (Array.isArray(tmp)) {
804808
ret[t] = tmp[0];

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.js

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,8 @@
250250
};
251251
}
252252

253+
/* eslint-disable unicorn/prefer-spread -- IIRC, Babel's performance
254+
with this not good */
253255
var hasOwnProp = Object.prototype.hasOwnProperty;
254256
/**
255257
* @typedef {null|boolean|number|string|PlainObject|GenericArray} JSONObject
@@ -433,7 +435,8 @@
433435

434436

435437
JSONPath.prototype.evaluate = function (expr, json, callback, otherTypeCallback) {
436-
var that = this;
438+
var _this2 = this;
439+
437440
var currParent = this.parent,
438441
currParentProperty = this.parentProperty;
439442
var flatten = this.flatten,
@@ -502,7 +505,7 @@
502505
}
503506

504507
return result.reduce(function (rslt, ea) {
505-
var valOrPath = that._getPreferredOutput(ea);
508+
var valOrPath = _this2._getPreferredOutput(ea);
506509

507510
if (flatten && Array.isArray(valOrPath)) {
508511
rslt = rslt.concat(valOrPath);
@@ -567,10 +570,11 @@
567570

568571

569572
JSONPath.prototype._trace = function (expr, val, path, parent, parentPropName, callback, hasArrExpr, literalPriority) {
573+
var _this3 = this;
574+
570575
// No expr to follow? return path and value as the result of
571576
// this trace branch
572577
var retObj;
573-
var that = this;
574578

575579
if (!expr.length) {
576580
retObj = {
@@ -616,7 +620,7 @@
616620
} else if (loc === '*') {
617621
// all child properties
618622
this._walk(loc, x, val, path, parent, parentPropName, callback, function (m, l, _x, v, p, par, pr, cb) {
619-
addRet(that._trace(unshift(m, _x), v, p, par, pr, cb, true, true));
623+
addRet(_this3._trace(unshift(m, _x), v, p, par, pr, cb, true, true));
620624
});
621625
} else if (loc === '..') {
622626
// all descendent parent properties
@@ -629,7 +633,7 @@
629633
if (_typeof(v[m]) === 'object') {
630634
// Keep going with recursive descent on val's
631635
// object children
632-
addRet(that._trace(unshift(l, _x), v[m], push(p, m), v, m, cb, true));
636+
addRet(_this3._trace(unshift(l, _x), v[m], push(p, m), v, m, cb, true));
633637
}
634638
}); // The parent sel computation is handled in the frame above using the
635639
// ancestor object of val
@@ -667,8 +671,8 @@
667671
}
668672

669673
this._walk(loc, x, val, path, parent, parentPropName, callback, function (m, l, _x, v, p, par, pr, cb) {
670-
if (that._eval(l.replace(/^\?\(((?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?)\)$/, '$1'), v[m], m, p, par, pr)) {
671-
addRet(that._trace(unshift(m, _x), v, p, par, pr, cb, true));
674+
if (_this3._eval(l.replace(/^\?\(((?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?)\)$/, '$1'), v[m], m, p, par, pr)) {
675+
addRet(_this3._trace(unshift(m, _x), v, p, par, pr, cb, true));
672676
}
673677
});
674678
} else if (loc[0] === '(') {
@@ -804,7 +808,7 @@
804808
var rett = ret[t];
805809

806810
if (rett && rett.isParentSelector) {
807-
var tmp = that._trace(rett.expr, val, rett.path, parent, parentPropName, callback, hasArrExpr);
811+
var tmp = this._trace(rett.expr, val, rett.path, parent, parentPropName, callback, hasArrExpr);
808812

809813
if (Array.isArray(tmp)) {
810814
ret[t] = tmp[0];

0 commit comments

Comments
 (0)