How to use the assertStringLiteral function from babel-types
Find comprehensive JavaScript babel-types.assertStringLiteral code examples handpicked from public code repositorys.
99 100 101 102 103 104 105 106
function extractRequiredModule (node) { t.assertCallExpression(node); t.assertIdentifier(node.callee, { name: 'require' }); var arg = node.arguments[0]; t.assertStringLiteral(arg); return arg.value; }
11
0
2
+ 7 other calls in file
72 73 74 75 76 77 78 79 80 81
baz: 1 }); t.is(ast.properties.length, 2); babelTypes.assertStringLiteral(ast.properties[0].key, { value: 'foo' }); babelTypes.assertStringLiteral(ast.properties[0].value, { value: 'bar' }); babelTypes.assertStringLiteral(ast.properties[1].key, { value: 'baz' }); babelTypes.assertNumericLiteral(ast.properties[1].value, { value: 1 }); t.pass();
4
0
0
+ 35 other calls in file
babel-types.identifier is the most popular function in babel-types (4076 examples)