Skip to main content
Module

x/typestruct/mod.ts>value

Composable and checkable JavaScript (and TypeScript) data structure
Latest
function value
import { value } from "https://deno.land/x/typestruct@1.0.0-beta.5/mod.ts";

Create primitive value struct.

Examples

Example 1

import { is, value } from "https://deno.land/x/typestruct@$VERSION/mod.ts";
import { assertEquals } from "https://deno.land/std@$VERSION/testing/asserts.ts";

assertEquals(is(value(null), null), true);
assertEquals(is(value(null), undefined), false);

Type Parameters

T extends
| string
| number
| bigint
| null
| undefined
| symbol
| boolean

Parameters

primitive: T

Primitive value.

optional
message: string | Messenger<ResultContext>

Custom issue message.

Returns

Struct<unknown, T>