From d379036e1f2d692a9ed3e0093c046a4872eb8486 Mon Sep 17 00:00:00 2001 From: Narek Hovhannisyan Date: Fri, 19 Jul 2024 16:07:11 +0400 Subject: [PATCH] fix(lib): tune regroup docs, types --- src/if-run/lib/regroup.ts | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/src/if-run/lib/regroup.ts b/src/if-run/lib/regroup.ts index 810da7c2d..eba87a4d0 100644 --- a/src/if-run/lib/regroup.ts +++ b/src/if-run/lib/regroup.ts @@ -17,11 +17,7 @@ export const Regroup = (inputs: PluginParams[], groups: string[]) => { /** * Creates structure to insert inputs by groups. */ - const appendGroup = ( - value: PluginParams, - object: any, - groups: string[] - ): any => { + const appendGroup = (value: PluginParams, object: any, groups: string[]) => { if (groups.length > 0) { const group = groups.shift() as string; @@ -46,26 +42,22 @@ export const Regroup = (inputs: PluginParams[], groups: string[]) => { }; /** - * Validates config parameter. + * Validates groups array. */ const validateGroups = (groups: string[]) => { - const inputData = { - groups, - }; - + const inputData = {groups}; const validationSchema = z.record( z.string(), z.array(z.string()).min(1, REGROUP_ERROR) ); - validate(validationSchema, inputData); return groups; }; /** - * Interates over inputs, grabs config-group types values for each one. - * Based on grouping types, initializes the structure grouped structure. + * Interates over inputs, grabs group values for each one. + * Based on grouping, initializes the structure. */ return inputs.reduce((acc, input) => { const validtedGroups = validateGroups(groups);