(value: any, isValidKey: (key: any) => boolean, isValidValue: (value: any) => boolean)
| 350 | // Validates whether the given object is a valid mapping of key and value type. |
| 351 | // EX: {"key": true, "key2": false} should return true for keyType = string and valueType = boolean. |
| 352 | export function isValidMapping(value: any, isValidKey: (key: any) => boolean, isValidValue: (value: any) => boolean): value is object { |
| 353 | if (isObject(value)) { |
| 354 | return Object.entries(value).every(([key, val]) => isValidKey(key) && isValidValue(val)); |
| 355 | } |
| 356 | return false; |
| 357 | } |
| 358 | |
| 359 | export function isOptionalArrayOfString(input: any): input is string[] | undefined { |
| 360 | return input === undefined || isArrayOfString(input); |
no test coverage detected