How to use the assertObjectExpression function from babel-types

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

164
165
166
167
168
169
170
171
172
173
  this._entriesFileIncosistentError(
    'Left side of the assignment must be a MemberExpression for the property exports'
  )
);

types.assertObjectExpression(expression.right);

// Finally add the entry
expression.right.properties.push(
  types.objectProperty(
fork icon0
star icon2
watch icon1

+ 9 other calls in file

7
8
9
10
11
12
13
14
15
16

const testSingleProperty = (t, obj, expectedOptions, expectedType) => {
    const [ key ] = R.keys(obj);
    const ast = buildLiteralAst(obj);

    babelTypes.assertObjectExpression(ast);

    t.is(ast.properties.length, 1);
    babelTypes.assertStringLiteral(ast.properties[0].key, { value: key });
    babelTypes[`assert${expectedType}Literal`](ast.properties[0].value, expectedOptions);
fork icon4
star icon0
watch icon0

+ 8 other calls in file

5
6
7
8
9
10
11
12
13
14

const visitors = {
  VariableDeclaration(node) {
    node.declarations.forEach((declaration) => {
      if (declaration.id.name === spreadProperty.argument.name) {
        t.assertObjectExpression(declaration.init);
        /**
         * Theoretically, `init` may contain nested spreads, but for now
         * I don't take it into account.
         * @todo Recursively check for nested spreads
fork icon3
star icon24
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)