Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
81162 views
1
/**
2
* Copyright 2013-2014, Facebook, Inc.
3
* All rights reserved.
4
*
5
* This source code is licensed under the BSD-style license found in the
6
* LICENSE file in the root directory of this source tree. An additional grant
7
* of patent rights can be found in the PATENTS file in the same directory.
8
*
9
* @providesModule isNode
10
* @typechecks
11
*/
12
13
/**
14
* @param {*} object The object to check.
15
* @return {boolean} Whether or not the object is a DOM node.
16
*/
17
function isNode(object) {
18
return !!(object && (
19
typeof Node === 'function' ? object instanceof Node :
20
typeof object === 'object' &&
21
typeof object.nodeType === 'number' &&
22
typeof object.nodeName === 'string'
23
));
24
}
25
26
module.exports = isNode;
27
28