UNPKG

@toreda/strong-types

Version:

Better TypeScript code in fewer lines.

1 lines 816 B
{"version":3,"sources":["../src/url/make.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,GAAG,EAAC,MAAM,QAAQ,CAAC;AAI3B;;;;;;;GAOG;AACH,wBAAgB,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,GAAG,CAMpE","file":"make.d.ts","sourcesContent":["import {Rules} from '../rules';\nimport {Url} from '../url';\nimport {createType} from '../create/type';\nimport {initialValue} from '../initial/value';\n\n/**\n * Create new strong Url object. Only valid Urls can be set.\n * @param fallback\n * @param initial\n * @returns\n *\n * @category Strings\n */\nexport function urlMake(fallback: string, value?: string | null): Url {\n\tconst rules = new Rules();\n\trules.add().must.match.type.string();\n\trules.add().must.be.url();\n\n\treturn createType<string>(fallback, initialValue(value), rules, 'Url');\n}\n"]}