MCPcopy
hub / github.com/fanmingming/live / parseText

Function parseText

m3u8/vue.js:9079–9112  ·  view source on GitHub ↗
(
    text,
    delimiters
  )

Source from the content-addressed store, hash-verified

9077
9078
9079 function parseText (
9080 text,
9081 delimiters
9082 ) {
9083 var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
9084 if (!tagRE.test(text)) {
9085 return
9086 }
9087 var tokens = [];
9088 var rawTokens = [];
9089 var lastIndex = tagRE.lastIndex = 0;
9090 var match, index, tokenValue;
9091 while ((match = tagRE.exec(text))) {
9092 index = match.index;
9093 // push text token
9094 if (index > lastIndex) {
9095 rawTokens.push(tokenValue = text.slice(lastIndex, index));
9096 tokens.push(JSON.stringify(tokenValue));
9097 }
9098 // tag token
9099 var exp = parseFilters(match[1].trim());
9100 tokens.push(("_s(" + exp + ")"));
9101 rawTokens.push({ '@binding': exp });
9102 lastIndex = index + match[0].length;
9103 }
9104 if (lastIndex < text.length) {
9105 rawTokens.push(tokenValue = text.slice(lastIndex));
9106 tokens.push(JSON.stringify(tokenValue));
9107 }
9108 return {
9109 expression: tokens.join('+'),
9110 tokens: rawTokens
9111 }
9112 }
9113
9114 /* */
9115

Callers 4

transformNodeFunction · 0.85
transformNode$1Function · 0.85
parseFunction · 0.85
processAttrsFunction · 0.85

Calls 1

parseFiltersFunction · 0.85

Tested by

no test coverage detected