How to use the assertArrayExpression function from @babel/types

Find comprehensive JavaScript @babel/types.assertArrayExpression code examples handpicked from public code repositorys.

85
86
87
88
89
90
91
92
93
94
const ast = buildLiteralAst({
    foo: [ 'bar', 1 ]
});

babelTypes.assertStringLiteral(ast.properties[0].key, { value: 'foo' });
babelTypes.assertArrayExpression(ast.properties[0].value);

t.is(ast.properties[0].value.elements.length, 2);
babelTypes.assertStringLiteral(ast.properties[0].value.elements[0], { value: 'bar' });
babelTypes.assertNumericLiteral(ast.properties[0].value.elements[1], { value: 1 });
fork icon4
star icon8
watch icon4

Other functions in @babel/types

Sorted by popularity

function icon

@babel/types.identifier is the most popular function in @babel/types (20936 examples)