Skip to content

Commit

Permalink
- Update: Build as per refactoring
Browse files Browse the repository at this point in the history
- Docs: Update as per typedoc update
- Linting: As per latest ash-nazg
- npm: Update devDeps.
- npm: Bump to 5.0.3
  • Loading branch information
brettz9 committed Feb 6, 2021
1 parent 3b60ae3 commit a2b663e
Show file tree
Hide file tree
Showing 22 changed files with 11,522 additions and 748 deletions.
8 changes: 8 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 1,13 @@
# CHANGES for jsonpath-plus

## 5.0.3 (2021-02-06)

- Fix: Add package exports for browser and umd (#145) (@gjvoosten)
- Update: Build as per refactoring
- Docs: Update as per typedoc update
- Linting: As per latest ash-nazg
- npm: Update devDeps.

## 5.0.2 (2021-01-15)

- Fix: Proper Node CommonJS export; fixes #144
Expand Down
20 changes: 12 additions & 8 deletions dist/index-browser-esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 244,8 @@ function _createForOfIteratorHelper(o, allowArrayLike) {
};
}

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


JSONPath.prototype.evaluate = function (expr, json, callback, otherTypeCallback) {
var that = this;
var _this2 = this;

var currParent = this.parent,
currParentProperty = this.parentProperty;
var flatten = this.flatten,
Expand Down Expand Up @@ -496,7 499,7 @@ JSONPath.prototype.evaluate = function (expr, json, callback, otherTypeCallback)
}

return result.reduce(function (rslt, ea) {
var valOrPath = that._getPreferredOutput(ea);
var valOrPath = _this2._getPreferredOutput(ea);

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


JSONPath.prototype._trace = function (expr, val, path, parent, parentPropName, callback, hasArrExpr, literalPriority) {
var _this3 = this;

// No expr to follow? return path and value as the result of
// this trace branch
var retObj;
var that = this;

if (!expr.length) {
retObj = {
Expand Down Expand Up @@ -610,7 614,7 @@ JSONPath.prototype._trace = function (expr, val, path, parent, parentPropName, c
} else if (loc === '*') {
// all child properties
this._walk(loc, x, val, path, parent, parentPropName, callback, function (m, l, _x, v, p, par, pr, cb) {
addRet(that._trace(unshift(m, _x), v, p, par, pr, cb, true, true));
addRet(_this3._trace(unshift(m, _x), v, p, par, pr, cb, true, true));
});
} else if (loc === '..') {
// all descendent parent properties
Expand All @@ -623,7 627,7 @@ JSONPath.prototype._trace = function (expr, val, path, parent, parentPropName, c
if (_typeof(v[m]) === 'object') {
// Keep going with recursive descent on val's
// object children
addRet(that._trace(unshift(l, _x), v[m], push(p, m), v, m, cb, true));
addRet(_this3._trace(unshift(l, _x), v[m], push(p, m), v, m, cb, true));
}
}); // The parent sel computation is handled in the frame above using the
// ancestor object of val
Expand Down Expand Up @@ -661,8 665,8 @@ JSONPath.prototype._trace = function (expr, val, path, parent, parentPropName, c
}

this._walk(loc, x, val, path, parent, parentPropName, callback, function (m, l, _x, v, p, par, pr, cb) {
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)) {
addRet(that._trace(unshift(m, _x), v, p, par, pr, cb, true));
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)) {
addRet(_this3._trace(unshift(m, _x), v, p, par, pr, cb, true));
}
});
} else if (loc[0] === '(') {
Expand Down Expand Up @@ -798,7 802,7 @@ JSONPath.prototype._trace = function (expr, val, path, parent, parentPropName, c
var rett = ret[t];

if (rett && rett.isParentSelector) {
var tmp = that._trace(rett.expr, val, rett.path, parent, parentPropName, callback, hasArrExpr);
var tmp = this._trace(rett.expr, val, rett.path, parent, parentPropName, callback, hasArrExpr);

if (Array.isArray(tmp)) {
ret[t] = tmp[0];
Expand Down
2 changes: 1 addition & 1 deletion dist/index-browser-esm.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index-browser-esm.min.js.map

Large diffs are not rendered by default.

20 changes: 12 additions & 8 deletions dist/index-browser-umd.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 250,8 @@
};
}

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


JSONPath.prototype.evaluate = function (expr, json, callback, otherTypeCallback) {
var that = this;
var _this2 = this;

var currParent = this.parent,
currParentProperty = this.parentProperty;
var flatten = this.flatten,
Expand Down Expand Up @@ -502,7 505,7 @@
}

return result.reduce(function (rslt, ea) {
var valOrPath = that._getPreferredOutput(ea);
var valOrPath = _this2._getPreferredOutput(ea);

if (flatten && Array.isArray(valOrPath)) {
rslt = rslt.concat(valOrPath);
Expand Down Expand Up @@ -567,10 570,11 @@


JSONPath.prototype._trace = function (expr, val, path, parent, parentPropName, callback, hasArrExpr, literalPriority) {
var _this3 = this;

// No expr to follow? return path and value as the result of
// this trace branch
var retObj;
var that = this;

if (!expr.length) {
retObj = {
Expand Down Expand Up @@ -616,7 620,7 @@
} else if (loc === '*') {
// all child properties
this._walk(loc, x, val, path, parent, parentPropName, callback, function (m, l, _x, v, p, par, pr, cb) {
addRet(that._trace(unshift(m, _x), v, p, par, pr, cb, true, true));
addRet(_this3._trace(unshift(m, _x), v, p, par, pr, cb, true, true));
});
} else if (loc === '..') {
// all descendent parent properties
Expand All @@ -629,7 633,7 @@
if (_typeof(v[m]) === 'object') {
// Keep going with recursive descent on val's
// object children
addRet(that._trace(unshift(l, _x), v[m], push(p, m), v, m, cb, true));
addRet(_this3._trace(unshift(l, _x), v[m], push(p, m), v, m, cb, true));
}
}); // The parent sel computation is handled in the frame above using the
// ancestor object of val
Expand Down Expand Up @@ -667,8 671,8 @@
}

this._walk(loc, x, val, path, parent, parentPropName, callback, function (m, l, _x, v, p, par, pr, cb) {
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)) {
addRet(that._trace(unshift(m, _x), v, p, par, pr, cb, true));
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)) {
addRet(_this3._trace(unshift(m, _x), v, p, par, pr, cb, true));
}
});
} else if (loc[0] === '(') {
Expand Down Expand Up @@ -804,7 808,7 @@
var rett = ret[t];

if (rett && rett.isParentSelector) {
var tmp = that._trace(rett.expr, val, rett.path, parent, parentPropName, callback, hasArrExpr);
var tmp = this._trace(rett.expr, val, rett.path, parent, parentPropName, callback, hasArrExpr);

if (Array.isArray(tmp)) {
ret[t] = tmp[0];
Expand Down
Loading

0 comments on commit a2b663e

Please sign in to comment.