MCPcopy Create free account
hub / github.com/NativeScript/NativeScript / getParamsArray

Function getParamsArray

packages/core/ui/builder/binding-builder.ts:88–121  ·  view source on GitHub ↗
(value: string)

Source from the content-addressed store, hash-verified

86}
87
88function getParamsArray(value: string) {
89 const result = [];
90 let skipComma = 0;
91 let indexReached = 0;
92 let singleQuoteBlock = false;
93 let doubleQuoteBlock = false;
94
95 for (let i = 0; i < value.length; i++) {
96 if (value[i] === '"') {
97 doubleQuoteBlock = !doubleQuoteBlock;
98 }
99
100 if (value[i] === "'") {
101 singleQuoteBlock = !singleQuoteBlock;
102 }
103
104 if (value[i] === '(' || value[i] === '[') {
105 skipComma++;
106 }
107
108 if (value[i] === ')' || value[i] === ']') {
109 skipComma--;
110 }
111
112 if (value[i] === ',' && skipComma === 0 && !(singleQuoteBlock || doubleQuoteBlock)) {
113 result.push(value.substr(indexReached, i - indexReached));
114 indexReached = i + 1;
115 }
116 }
117
118 result.push(value.substr(indexReached));
119
120 return result;
121}
122
123function isExpression(expression: string): boolean {
124 return expression.search(expressionSymbolsRegex) > -1;

Callers 1

getBindingOptionsFunction · 0.85

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected