UNPKG

@frauschert/ts-guard

Version:

ts-guard is a typescript library that provides composable type guards. Its inspired by zod but focusses only on type guards and is more lightweight.

17 lines 461 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isMap = isMap; function isMap(keyGuard, valueGuard) { return (value) => { if (!(value instanceof Map)) { return false; } for (const [key, val] of value.entries()) { if (!keyGuard(key) || !valueGuard(val)) { return false; } } return true; }; } //# sourceMappingURL=isMap.js.map