How to use the isFunctionExpression function from babel-types

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

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

+ 5 other calls in file

2
3
4
5
6
7
8
9
10
11

module.exports = parseNode;

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

+ 7 other calls in file

58
59
60
61
62
63
64
65
66
67
    return node.some(ancestor => hasBinding(ancestor, name));
}
else if (types.isProgram(node) || 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 (
        (node.id !== null && node.id.name === name) ||
        node.params.some(
            param => types.isIdentifier(param) && param.name === name
fork icon0
star icon2
watch icon0

+ 3 other calls in file

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

3
4
5
6
7
8
9
10
11
12

const isNodeTypeAFunction = n =>
        t.isFunctionDeclaration(n) ||
        t.isArrowFunctionExpression(n) ||
        t.isClassMethod(n) ||
        t.isFunctionExpression(n);

// What to do with declareFunction type?
const isPathTypeAFunction = p =>
        p.isFunctionDeclaration() ||
fork icon2
star icon60
watch icon3

140
141
142
143
144
145
146
147
148
149
const expr = statement.expression;
const { left, right } = expr;
if (t.isMemberExpression(left) &&
    t.isThisExpression(left.object) &&
    t.isIdentifier(left.property)) {
    if ((t.isArrowFunctionExpression(right) || t.isFunctionExpression(right)) ||
        (left.property.name === 'config' && t.isObjectExpression(right))) {
        body.push(t.classProperty(left.property, right));
        _.remove(method.body.body, statement);
    }
fork icon0
star icon0
watch icon0

+ 6 other calls in file

799
800
801
802
803
804
805
806
807
808
  t.isMemberExpression(left) &&
    t.isThisExpression(left.object) &&
    t.isIdentifier(left.property)
) {
  if (
    (t.isArrowFunctionExpression(right) || t.isFunctionExpression(right)) ||
      (left.property.name === 'config' && t.isObjectExpression(right))
  ) {
    body.push(
      t.classProperty(left.property, right)
fork icon0
star icon0
watch icon0

Other functions in babel-types

Sorted by popularity

function icon

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