Update index.js
This commit is contained in:
parent
1cce236405
commit
1d5bf2922a
1 changed files with 10 additions and 6 deletions
16
index.js
16
index.js
|
|
@ -161,13 +161,17 @@ is.inRange = (x, range) => {
|
|||
throw new TypeError(`Invalid range: ${util.inspect(range)}`);
|
||||
};
|
||||
|
||||
const NODE_TYPE_ELEMENT_NODE = 1;
|
||||
const DOM_PROPERTIES_TO_CHECK = ['innerHTML', 'ownerDocument', 'style', 'attributes', 'nodeValue'];
|
||||
const NODE_TYPE_ELEMENT = 1;
|
||||
const DOM_PROPERTIES_TO_CHECK = [
|
||||
'innerHTML',
|
||||
'ownerDocument',
|
||||
'style',
|
||||
'attributes',
|
||||
'nodeValue'
|
||||
];
|
||||
|
||||
is.domElement = x => {
|
||||
return is.object(x) && x.nodeType === NODE_TYPE_ELEMENT_NODE && is.string(x.nodeName) &&
|
||||
!is.plainObject(x) && DOM_PROPERTIES_TO_CHECK.every(property => property in x);
|
||||
};
|
||||
is.domElement = x => is.object(x) && x.nodeType === NODE_TYPE_ELEMENT && is.string(x.nodeName) &&
|
||||
!is.plainObject(x) && DOM_PROPERTIES_TO_CHECK.every(property => property in x);
|
||||
|
||||
is.infinite = x => x === Infinity || x === -Infinity;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue