MCPcopy Create free account
hub / github.com/microsoft/vscode-cpptools / isValidMapping

Function isValidMapping

Extension/src/common.ts:352–357  ·  view source on GitHub ↗
(value: any, isValidKey: (key: any) => boolean, isValidValue: (value: any) => boolean)

Source from the content-addressed store, hash-verified

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.
352export 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
359export function isOptionalArrayOfString(input: any): input is string[] | undefined {
360 return input === undefined || isArrayOfString(input);

Callers 4

getAsExcludesMethod · 0.90
getAsAssociationsMethod · 0.90
getAsAssociationsMethod · 0.90
getAsExcludesMethod · 0.90

Calls 2

isObjectFunction · 0.85
entriesMethod · 0.80

Tested by

no test coverage detected