@cowwoc/requirements
Version:
A fluent API for enforcing design contracts with automatic message generation.
30 lines • 1.06 kB
JavaScript
/*
* Copyright (c) 2019 Gili Tzabari
* Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
*/
import { AbstractValidator, messagesConstraint } from "../internal.mjs";
/**
* @param validator - the validator
* @returns a message for the validation failure
*/
function classIsPrimitive(validator) {
return messagesConstraint(validator, "must be a primitive type");
}
/**
* @param subtype - the subtype
* @param validator - the validator
* @returns a message for the validation failure
*/
function classIsSupertypeOf(validator, subtype) {
return messagesConstraint(validator, " must be a supertype of " + subtype.toString());
}
/**
* @param supertype - the supertype
* @param validator - the validator
* @returns a message for the validation failure
*/
function classIsSubtypeOf(validator, supertype) {
return messagesConstraint(validator, "must be a subtype of " + supertype.toString());
}
export { classIsPrimitive, classIsSupertypeOf, classIsSubtypeOf };
//# sourceMappingURL=ClassMessages.mjs.map