tiny-types
Version:
A tiny library that brings Tiny Types to JavaScript and TypeScript
21 lines (20 loc) • 509 B
TypeScript
import { Predicate } from './Predicate';
/**
* @desc Ensures that the `value` starts with a given prefix.
*
* @example
* import { ensure, startsWith, TinyType } from 'tiny-types';
*
* class Username extends TinyType {
* constructor(public readonly value: string) {
* super();
*
* ensure('Username', value, startsWith('usr'));
* }
* }
*
* @param {string} prefix
*
* @returns {Predicate<string>}
*/
export declare function startsWith(prefix: string): Predicate<string>;