How to use the isFunctionDeclaration function from babel-types

Find comprehensive JavaScript babel-types.isFunctionDeclaration code examples handpicked from public code repositorys.

90
91
92
93
94
95
96
97
98
99
  babelTypes.isBlockStatement(node) ||
  babelTypes.isBlock(node)
) {
  return node.body.some(statement => hasBinding(statement, name));
} else if (
  babelTypes.isFunctionDeclaration(node) ||
  babelTypes.isFunctionExpression(node) ||
  babelTypes.isArrowFunctionExpression(node)
) {
  return (
fork icon0
star icon49
watch icon1

+ 5 other calls in file

4
5
6
7
8
9
10
11
12
13

function parseNode(contextNode) {
  if (
    t.isFunctionExpression(contextNode) ||
    t.isArrowFunctionExpression(contextNode) ||
    t.isFunctionDeclaration(contextNode) ||
    t.isObjectMethod(contextNode)
  ) {
    return parseFunctionExpression(contextNode);
  }
fork icon3
star icon6
watch icon1

+ 7 other calls in file

0
1
2
3
4
5
6
7
8
const t = require('babel-types');

const ANONYMOUS_FUNCTION = 'anonymous function';

const isNodeTypeAFunction = n =>
        t.isFunctionDeclaration(n) ||
        t.isArrowFunctionExpression(n) ||
        t.isClassMethod(n) ||
        t.isFunctionExpression(n);
fork icon2
star icon60
watch icon3

98
99
100
101
102
103
104
105
106
107
  types.isBlockStatement(node) ||
  types.isBlock(node)
) {
  return node.body.some(statement => hasBinding(statement, name));
} else if (
  types.isFunctionDeclaration(node) ||
  types.isFunctionExpression(node) ||
  types.isArrowFunctionExpression(node)
) {
  return (
fork icon0
star icon1
watch icon2

Other functions in babel-types

Sorted by popularity

function icon

babel-types.identifier is the most popular function in babel-types (4076 examples)