( args: any[], singleArgument?: boolean, )
| 7 | ): [any, any | void] |
| 8 | export function processArgsToConfig(args: any[]): [any[], any | void] |
| 9 | export 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 | /** |
| 39 | processed fields: |
no test coverage detected
searching dependent graphs…