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 });
4
8
4
@babel/types.identifier is the most popular function in @babel/types (20936 examples)