How to use the isNullLiteral function from @babel/types
Find comprehensive JavaScript @babel/types.isNullLiteral code examples handpicked from public code repositorys.
189 190 191 192 193 194 195 196 197 198
* 判断是否是null表达式 * @param node * @return {Boolean} */ function isNullLiteral(node) { return t.isNullLiteral(node) || t.isIdentifier(node, { name: 'null' }); } /** * 弃用指令错误
13
88
4
+ 3 other calls in file
125 126 127 128 129 130 131 132 133 134
btypes.identifier('false') ), [actual] ) } else if ( btypes.isNullLiteral(expected) || btypes.isIdentifier(expected, { name: 'undefined' }) ) { return btypes.callExpression( btypes.memberExpression(
0
15
1
GitHub: fish-uncle/uni-app
26 27 28 29 30 31 32 33 34 35
const expr = parseExpression(str) if ( t.isStringLiteral(expr) || t.isNumericLiteral(expr) || t.isBooleanLiteral(expr) || t.isNullLiteral(expr) ) { return false } return true
0
2
1
+ 25 other calls in file
GitHub: suchipi/tofu
85 86 87 88 89 90 91 92 93 94
} } if ( recursionDepth > 0 && (t.isBooleanLiteral(node) || t.isNullLiteral(node)) && ((isRight && start == node.start) || (isLeft && start == node.end)) ) { return [node.start, node.end]; }
4
0
1
+ 13 other calls in file
268 269 270 271 272 273 274 275 276 277 278
return nodes.concat(traverseExpr(exprNode, state)) }, []) } function genSlotNode (slotName, slotNode, fallbackNodes, state) { if (!fallbackNodes || t.isNullLiteral(fallbackNodes)) { return slotNode } // 支付宝小程序默认插槽为 $default if (state.options.platform.name === 'mp-alipay') {
0
1
1
+ 5 other calls in file
68 69 70 71 72 73 74 75 76 77
t.stringLiteral(value) ); const args = path.node.arguments; if ( !args[1] || t.isNullLiteral(args[1]) || isUndefinedIdentifier(args[1]) ) { args[1] = t.objectExpression([]); }
0
1
1
+ 10 other calls in file
GitHub: dcloudio/uni-app
119 120 121 122 123 124 125 126 127 128
}] if ( !( (t.isCallExpression(conditionalExprNode.alternate) && t.isIdentifier(conditionalExprNode.alternate.callee) && conditionalExprNode.alternate.callee.name === '_e') || t.isNullLiteral(conditionalExprNode.alternate) ) ) { // test?_c():_e() ret.push({
0
0
502
+ 277 other calls in file
@babel/types.identifier is the most popular function in @babel/types (20936 examples)