Skip to main content
Latest
function primitiveParse
import { primitiveParse } from "https://deno.land/x/simple_utility@v2.1.0/mod.pure.full.ts";

Convert from dirty text to specified type. Enabling strict flag will throw exception if parsing failed.

Examples

Example 1

const value = primitiveParse("123", "number", true);

Type Parameters

T extends keyof PrimitiveMap
U extends boolean

Parameters

text: MaybeString
type: T
optional
strict: U

Returns

TypeStrict<PrimitiveMap[T], U>