Skip to content

Commit e08744c

Browse files
committed
Add support of class getter
Fix JSONPath-Plus#174
1 parent c04d1e8 commit e08744c

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/jsonpath.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
const {hasOwnProperty: hasOwnProp} = Object.prototype;
21

32
/**
43
* @typedef {null|boolean|number|string|PlainObject|GenericArray} JSONObject
@@ -12,6 +11,17 @@ const {hasOwnProperty: hasOwnProp} = Object.prototype;
1211
* @typedef {any} AnyResult
1312
*/
1413

14+
/**
15+
* Check if the provided property name exists on the object.
16+
* @param {string} name Name of the property to check
17+
* @returns {boolean} Whether the object has the property or not
18+
*/
19+
function hasOwnProp (name) {
20+
return typeof this === 'object'
21+
? name in this
22+
: Object.prototype.hasOwnProperty.call(this, name);
23+
}
24+
1525
/**
1626
* Copies array and then pushes item into it.
1727
* @param {GenericArray} arr Array to copy and into which to push

0 commit comments

Comments
 (0)