MCPcopy
hub / github.com/apache/echarts / RegExpEvaluator

Class RegExpEvaluator

src/util/conditionalExpression.ts:173–196  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

171
172
173class RegExpEvaluator implements FilterComparator {
174 private _condVal: RegExp;
175
176 constructor(rVal: unknown) {
177 // Support condVal: RegExp | string
178 const condValue = this._condVal = isString(rVal) ? new RegExp(rVal)
179 : isRegExp(rVal) ? rVal as RegExp
180 : null;
181 if (condValue == null) {
182 let errMsg = '';
183 if (__DEV__) {
184 errMsg = makePrintable('Illegal regexp', rVal, 'in');
185 }
186 throwError(errMsg);
187 }
188 }
189
190 evaluate(lVal: unknown): boolean {
191 const type = typeof lVal;
192 return isString(type) ? this._condVal.test(lVal as string)
193 : isNumber(type) ? this._condVal.test(lVal + '')
194 : false;
195 }
196}
197
198
199

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…