MCPcopy Index your code
hub / github.com/effector/effector / processArgsToConfig

Function processArgsToConfig

src/effector/config.ts:9–36  ·  view source on GitHub ↗
(
  args: any[],
  singleArgument?: boolean,
)

Source from the content-addressed store, hash-verified

7): [any, any | void]
8export function processArgsToConfig(args: any[]): [any[], any | void]
9export function processArgsToConfig(
10 args: any[],
11 singleArgument?: boolean,
12): [any[], any | void] {
13 const rawConfig = singleArgument ? args : args[0]
14 assertObject(rawConfig)
15 let metadata = rawConfig.or
16 const childConfig = rawConfig.and
17 if (childConfig) {
18 const unwrappedNestedValue = singleArgument ? childConfig : childConfig[0]
19 /**
20 * if there is no "and" field then we reached the leaf of the tree
21 * and this is an original user-defined argument
22 *
23 * note that in this case we're returning all arguments, not the only one been unwrapped
24 **/
25 if (!isObject(unwrappedNestedValue) || !('and' in unwrappedNestedValue)) {
26 args = childConfig
27 } else {
28 //@ts-expect-error
29 const nested = processArgsToConfig(childConfig, singleArgument)
30
31 args = nested[0]
32 metadata = {...metadata, ...nested[1]}
33 }
34 }
35 return [args, metadata]
36}
37
38/**
39processed fields:

Callers 10

processCreateGateConfigFunction · 0.90
createGateFunction · 0.90
splitFunction · 0.90
forwardFunction · 0.90
combineFunction · 0.90
guardFunction · 0.90
attachFunction · 0.90
createApiFunction · 0.90
sampleFunction · 0.90
createGateFunction · 0.90

Calls 2

assertObjectFunction · 0.90
isObjectFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…