Skip to content

Commit

Permalink
Use has module instead of hasOwnProperty
Browse files Browse the repository at this point in the history
  • Loading branch information
Brandon Dail authored and ljharb committed Sep 27, 2017
1 parent 94011e2 commit 9751ed8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/enzyme/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"dependencies": {
"cheerio": "^1.0.0-rc.2",
"function.prototype.name": "^1.0.3",
"has": "^1.0.1",
"is-subset": "^0.1.1",
"lodash": "^4.17.4",
"object-is": "^1.0.1",
Expand Down
3 changes: 2 additions & 1 deletion packages/enzyme/src/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import isEmpty from 'lodash/isEmpty';
import flatten from 'lodash/flatten';
import unique from 'lodash/uniq';
import is from 'object-is';
import has from 'has';
import {
treeFilter,
nodeHasId,
Expand Down Expand Up @@ -67,7 +68,7 @@ function matchAttributeSelector(node, token) {
return nodeHasMatchingProperty(node, token.name, (nodePropValue, nodeProps) => {
const { operator, value } = token;
if (token.type === ATTRIBUTE_PRESENCE) {
return Object.prototype.hasOwnProperty.call(nodeProps, token.name);
return has(nodeProps, token.name);
}
// Only the exact value operator ("=") can match non-strings
if (typeof nodePropValue !== 'string' || typeof value !== 'string') {
Expand Down

0 comments on commit 9751ed8

Please sign in to comment.