Skip to content

Commit a9441c3

Browse files
Update packages/nodes-base/utils/types.ts
Co-authored-by: do-refacto[bot] <198860923+do-refacto[bot]@users.noreply.github.com>
1 parent 3438015 commit a9441c3

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

packages/nodes-base/utils/types.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -81,16 +81,14 @@ function assertIsObjectType(parameterName: string, value: unknown): void {
8181
}
8282

8383
function createElementValidator(elementType: 'string' | 'number' | 'boolean') {
84-
return (val: unknown): val is string | number | boolean => typeof val === elementType;
84+
if (elementType === 'string') {
85+
return (val: unknown): val is string => typeof val === 'string';
86+
} else if (elementType === 'number') {
87+
return (val: unknown): val is number => typeof val === 'number';
88+
} else {
89+
return (val: unknown): val is boolean => typeof val === 'boolean';
90+
}
8591
}
86-
87-
function assertIsArrayType(parameterName: string, value: unknown, arrayType: string): void {
88-
const baseType = arrayType.slice(0, -2);
89-
const elementType =
90-
baseType === 'string' || baseType === 'number' || baseType === 'boolean' ? baseType : 'string';
91-
92-
const validator = createElementValidator(elementType as 'string' | 'number' | 'boolean');
93-
assertIsArray(parameterName, value, validator);
9492
}
9593

9694
function assertIsPrimitiveType(parameterName: string, value: unknown, type: string): void {

0 commit comments

Comments
 (0)