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

Function getTokenValue

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

Source from the content-addressed store, hash-verified

261 }
262
263 function getTokenValue() {
264 const pureTokenValue = tokenValue.slice(1, -1).replace(/\\(.)/g, '$1');
265 const field = revertFieldMap[pureTokenValue];
266 const fieldRole = getFieldRoleByFieldId(fieldPermissionMap, pureTokenValue);
267
268 if (fieldRole === ConfigConstant.Role.None) {
269 return `{${t(Strings.crypto_field)}}`;
270 }
271
272 // Convert the variable name according to the 'to' parameter
273 if (field) {
274 return to === 'id' ? `{${field.id}}` : `{${field.name.replace(/[{}\\]/g, '\\$&')}}`;
275 }
276
277 console.log(
278 t(Strings.not_found_field_the_name_as, {
279 value: pureTokenValue,
280 }),
281 );
282 return tokenValue;
283 }
284
285 if (token.type === TokenType.PureValue) {
286 tokenValue = getPureTokenValue();

Callers 1

expressionTransformFunction · 0.85

Calls 4

getFieldRoleByFieldIdFunction · 0.90
tFunction · 0.90
replaceMethod · 0.45
logMethod · 0.45

Tested by

no test coverage detected