Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/simple_utility/mod.ts>primitiveParse

Useful snippet collection.
Go to Latest
function primitiveParse
import { primitiveParse } from "https://deno.land/x/simple_utility@v1.6.0/mod.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