class-validator-extended
Version:
Additional validators for class-validator.
18 lines (17 loc) • 565 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.mapNotContains = mapNotContains;
const is_map_1 = require("../../type/is-map");
/**
* @category Predicates
* @param value The value to validate.
* @param forbidden List of forbidden values for this map.
* @typeParam Value The type of values to check for.
*/
function mapNotContains(value, forbidden) {
if (!(0, is_map_1.isMap)(value)) {
return false;
}
const values = new Set(value.values());
return [...forbidden].every(item => !values.has(item));
}