Skip to main content
Module

x/fun/mod.ts>json_schema.nullable

A collection of algebraic data types, lenses, and schemables based on a light weight higher kinded type implementation. Written for deno.
Latest
function json_schema.nullable
import { json_schema } from "https://deno.land/x/fun@v2.0.0/mod.ts";
const { nullable } = json_schema;

Creates a JsonBuilder that makes the given builder nullable

Examples

Example 1

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

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