tiny-types
Version:
A tiny library that brings Tiny Types to JavaScript and TypeScript
23 lines • 665 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.isNotBlank = isNotBlank;
const Predicate_1 = require("./Predicate");
/**
* @desc
* Ensures that the `value` is not an empty string.
*
* @example
* import { ensure, isString, TinyType } from 'tiny-types';
*
* class FirstName extends TinyType {
* constructor(public readonly value: string) {
* ensure('FirstName', value, isNotBlank());
* }
* }
*
* @returns {Predicate<string>}
*/
function isNotBlank() {
return Predicate_1.Predicate.to(`not be blank`, (value) => typeof value === 'string' && value !== '');
}
//# sourceMappingURL=isNotBlank.js.map