MCPcopy Create free account
hub / github.com/ygs-code/vue / checkEvent

Function checkEvent

vue.js:15379–15391  ·  view source on GitHub ↗
(exp, text, errors)

Source from the content-addressed store, hash-verified

15377
15378 //检查事件,去除掉模板字符串,匹配是否含有delete (任何字符) 或 typeof (任何字符) 或 void (任何字符) 关键词,检查字符串开头是否含有$
15379 function checkEvent(exp, text, errors) {
15380 var stipped = exp.replace(stripStringRE, ''); //去除掉模板字符串
15381 var keywordMatch = stipped.match(unaryOperatorsRE); //匹配是否含有delete (任何字符) 或 typeof (任何字符) 或 void (任何字符) 关键词
15382 //判断匹配到的 字符串 开头是否是$ 开头的
15383 if (keywordMatch && stipped.charAt(keywordMatch.index - 1) !== '$') {
15384 errors.push(
15385 "avoid using JavaScript unary operator as property name: " +
15386 "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim())
15387 );
15388 }
15389 //字符串转成真正js的时候是否会报错 可以替代eval()
15390 checkExpression(exp, text, errors);
15391 }
15392
15393 //检查 for
15394 function checkFor(node, //节点

Callers 1

checkNodeFunction · 0.85

Calls 1

checkExpressionFunction · 0.85

Tested by

no test coverage detected