MCPcopy Index your code
hub / github.com/ygs-code/vue / wrapFilter

Function wrapFilter

vue.js:9619–9644  ·  view source on GitHub ↗
(exp, filter)

Source from the content-addressed store, hash-verified

9617 */
9618 console.log(wrapFilter('abc', 'defg(hijk)')) //结果 _f("defg")(abc,hijk)
9619 function wrapFilter(exp, filter) {
9620 var i = filter.indexOf('('); //返回字符串第一次出现索引的位置
9621 console.log('i=' + i)
9622 if (i < 0) {
9623 // _f: resolveFilter
9624 return ("_f(\"" + filter + "\")(" + exp + ")") //闭包
9625 } else {
9626 //name 是 从字符串开始到(结束的字符串,不包含(
9627 var name = filter.slice(0, i); //截取字符串 arrayObject.slice(start,end)
9628 console.log('==name==')
9629 console.log(name)
9630
9631 //args是从(开始匹配,到字符串末端,不包含(
9632 var args = filter.slice(i + 1); //如果 end 未被规定,那么 slice() 方法会选取从 start 到数组结尾的所有元素。
9633 console.log('==args==')
9634 console.log(args)
9635 return (
9636 "_f(\"" + name + "\")(" + exp +
9637 (
9638 args !== ')' ?
9639 ',' + args
9640 : args
9641 )
9642 )
9643 }
9644 }
9645
9646
9647 /* */

Callers 2

parseFiltersFunction · 0.85
vue.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected