UNPKG

fluent-ts-validator

Version:
26 lines 787 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const _1 = require("../../shared/"); /** * Validates if given value is empty (=== '', === null, === undefined) * or in case of certain iterables if they do not contain any element * (length === 0, size === 0). * * @export * @class IsEmptyValidator * @implements {PropertyValidator<any>} */ class IsEmptyValidator { isValid(input) { return input === "" || input === null || input === undefined || this.isEmptyCollection(input); } isEmptyCollection(input) { if (_1.isIterable(input)) { return _1.isIterableEmtpy(input); } return false; } } exports.IsEmptyValidator = IsEmptyValidator; //# sourceMappingURL=IsEmptyValidator.js.map