How to use the nullLiteral function from babel-types
Find comprehensive JavaScript babel-types.nullLiteral code examples handpicked from public code repositorys.
GitHub: sbekrin/cljs-babel
123 124 125 126 127 128 129 130 131 132
return node.negative ? t.unaryExpression('-', t.identifier('Infinity')) : t.identifier('Infinity'); // nil -> null case l.NullNode: return t.nullLiteral(); default: throw new Error( `Compile error, unknown node type ${node.constructor.name}` );
1
10
2
+ 9 other calls in file
GitHub: KieSun/vue-to-react
22 23 24 25 26 27 28 29 30
parentPath.replaceWith( t.jSXExpressionContainer( t.conditionalExpression( test, parentPath.node, nextElement ? nextElement : t.nullLiteral() ) ) );
65
2
2
+ 3 other calls in file
GitHub: roland-reed/nanachi-cli
142 143 144 145 146 147 148 149 150
if (t.isReturnStatement(node)) return node.argument; return transformNonNullConsequentOrAlternate(node); } function transformAlternate(node) { if (node == null) return t.nullLiteral(); if (t.isReturnStatement(node)) return node.argument; return transformNonNullConsequentOrAlternate(node); }
3
10
2
+ 3 other calls in file
GitHub: xiaohuoni/taro
39 40 41 42 43 44 45 46 47 48
} if (Array.isArray(value)) { return convertArrayToAstExpression(value) } if (value == null) { return t.nullLiteral() } if (typeof value === 'object') { return t.objectExpression(convertObjectToAstExpression(value)) }
0
0
2
+ 5 other calls in file
18 19 20 21 22 23 24 25 26 27
*/ const generateLiteral = value => { if (_.isString(value)) return t.stringLiteral(value); if (_.isBoolean(value)) return t.booleanLiteral(value); if (_.isNumber(value)) return t.numericLiteral(value); if (_.isNull(value)) return t.nullLiteral(); if (_.isArray(value)) return t.arrayExpression(value.map(generateLiteral)); if (_.isObject(value)) { const properties = Object.keys(value).map(key => t.objectProperty(t.identifier(key), generateLiteral(value[key]))
0
0
4
+ 7 other calls in file
babel-types.identifier is the most popular function in babel-types (4076 examples)