Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions 21 lib/jsonpath.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ var module;
(function (glbl, require) {'use strict';

// Make sure to know if we are in real node or not (the `require` variable
// could actually be require.js, for example.
var isNode = module && !!module.exports;
// could actually be require.js, for example). Will also check if we are
// in react-native
var isNode = module && !!module.exports && !(typeof navigator !== 'undefined' && navigator.product === 'ReactNative');

var allowedResultTypes = ['value', 'path', 'pointer', 'parent', 'parentProperty', 'all'];

Expand Down Expand Up @@ -248,8 +249,8 @@ JSONPath.prototype._trace = function (expr, val, path, parent, parentPropName, c
// The parent sel computation is handled in the frame above using the
// ancestor object of val
else if (loc === '^') {
// This is not a final endpoint, so we do not invoke the callback here
this._hasParentSelector = true;
// This is not a final endpoint, so we do not invoke the callback here
this._hasParentSelector = true;
return path.length ? {
path: path.slice(0, -1),
expr: x,
Expand Down Expand Up @@ -354,11 +355,11 @@ JSONPath.prototype._trace = function (expr, val, path, parent, parentPropName, c

// We check the resulting values for parent selections. For parent
// selections we discard the value object and continue the trace with the
// current val object
if (this._hasParentSelector) {
for (var t = 0; t < ret.length; t++) {
// current val object
if (this._hasParentSelector) {
for (var t = 0; t < ret.length; t++) {
var rett = ret[t];
if (rett.isParentSelector) {
if (rett.isParentSelector) {
var tmp = self._trace(rett.expr, val, rett.path, parent, parentPropName, callback);
if (Array.isArray(tmp)) {
ret[t] = tmp[0];
Expand All @@ -370,10 +371,10 @@ JSONPath.prototype._trace = function (expr, val, path, parent, parentPropName, c
ret[t] = tmp;
}
}
}
}
}
return ret;
};
};

JSONPath.prototype._walk = function (loc, expr, val, path, parent, parentPropName, callback, f) {
var i, n, m;
Expand Down
3 changes: 3 additions & 0 deletions 3 package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@
"engines": {
"node": ">=0.8"
},
"react-native": {
"vm": false
},

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If React-Native doesn't support vm anyhow, what does this do?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will tell reacts module bundling not to look for the vm module. Even though the module will not be used during runtime the bundler is still trying to find it.

"devDependencies": {
"eslint": "^1.10.3",
"eslint-config-standard": "^4.4.0",
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.