Skip to main content
Go to Latest
function primitiveParse
import { primitiveParse } from "https://deno.land/x/simple_utility@v1.6.0/mod.universal.ts";

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

Examples

Example 1

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

Type Parameters

T extends keyof PrimitiveMap
U extends boolean

Parameters

type: T
optional
strict: U