How to use the assertObjectExpression function from @babel/types

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

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 icon8
watch icon4

+ 5 other calls in file

Other functions in @babel/types

Sorted by popularity

function icon

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