Skip to main content
Module

x/simple_utility/mod.pure.ts>primitiveParse

Simplify processing for Deno.
Go to Latest
function primitiveParse
import { primitiveParse } from "https://deno.land/x/simple_utility@v2.0.10/mod.pure.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>