MCPcopy Create free account
hub / github.com/apitable/apitable / getPureTokenValue

Function getPureTokenValue

packages/core/src/formula_parser/evaluate.ts:239–261  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

237 let tokenValue = token.value;
238
239 function getPureTokenValue() {
240 const pureTokenValue = token.value.replace(/\\(.)/g, '$1');
241 const field = revertFieldMap[pureTokenValue];
242 // Convert the variable name according to the to parameter
243 if (!field) {
244 return tokenValue;
245 }
246 if (to === 'id') {
247 return field.id;
248 }
249
250 const name = field.name.replace(/[{}\\]/g, '\\$&');
251 // When name contains illegal parameters, {} wrapping is required
252 if (/[/+\-|=*/><()()!&%'"“”‘’^`~,,\s]/.test(name)) {
253 return `{${name}}`;
254 }
255 console.log(
256 t(Strings.not_found_field_the_name_as, {
257 value: pureTokenValue,
258 }),
259 );
260 return name;
261 }
262
263 function getTokenValue() {
264 const pureTokenValue = tokenValue.slice(1, -1).replace(/\\(.)/g, '$1');

Callers 1

expressionTransformFunction · 0.85

Calls 4

tFunction · 0.90
replaceMethod · 0.45
testMethod · 0.45
logMethod · 0.45

Tested by

no test coverage detected