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

Function flattenParams

packages/core/src/formula_parser/functions/array.ts:45–59  ·  view source on GitHub ↗
(params: IFormulaParam[])

Source from the content-addressed store, hash-verified

43 * Flatten the value of the parameter
44 */
45export const flattenParams = (params: IFormulaParam[]): any[] => {
46 const value = params.reduce((prev, cur) => {
47 const { value, node } = cur;
48
49 if (cur.node.valueType === BasicValueType.Array) {
50 const { field, context } = node as ValueOperandNode;
51 if (Field.bindContext(field, context.state).isComputed) {
52 const v = (Field.bindContext(field, context.state) as any).arrayValueToArrayStringValueArray(value);
53 return v != null ? [...prev, v] : prev;
54 }
55 }
56 return value != null ? [...prev, value] : prev;
57 }, [] as IFormulaParam[]);
58 return value.flat(Infinity);
59};
60
61enum SymbolType {
62 Equal = 'Equal',

Callers 4

funcMethod · 0.90
funcMethod · 0.85
funcMethod · 0.85
funcMethod · 0.85

Tested by

no test coverage detected