Skip to main content
Module

x/fun/mod.ts>json_schema.undefinable

A collection of algebraic data types, lenses, and schemables based on a light weight higher kinded type implementation. Written for deno.
Go to Latest
function json_schema.undefinable
import { json_schema } from "https://deno.land/x/fun@v.2.0.0-alpha.11/mod.ts";
const { undefinable } = json_schema;

Creates a JsonBuilder that makes the given builder undefinable

Examples

Example 1

import * as J from "./json_schema.ts";
import { pipe } from "./fn.ts";

// schema === { anyOf: [ { enum: [ 1 ] }, {} ] }
const schema = J.print(J.undefinable(J.literal(1)));

Returns

JsonBuilder<A | undefined>