Debian Codegraph @

estree-is-function/index.js

raw
1 module.exports = function isFunction (node) {
2 if (typeof node !== 'object' || !node) {
3 throw new TypeError('estree-is-function: node must be an object')
4 }
5
6 if (typeof node.type !== 'string') {
7 throw new TypeError('estree-is-function: node must have a string type')
8 }
9
10 return node.type === 'FunctionDeclaration' || node.type === 'FunctionExpression' || node.type === 'ArrowFunctionExpression'
11 }