UNPKG

tiny-types

Version:

A tiny library that brings Tiny Types to JavaScript and TypeScript

22 lines 632 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isString = isString; const Predicate_1 = require("./Predicate"); /** * @desc Ensures that the `value` is a {@link String}. * * @example * import { ensure, isString, TinyType } from 'tiny-types'; * * class FirstName extends TinyType { * constructor(public readonly value: string) { * ensure('FirstName', value, isString()); * } * } * * @returns {Predicate<string>} */ function isString() { return Predicate_1.Predicate.to(`be a string`, (value) => typeof value === 'string'); } //# sourceMappingURL=isString.js.map