Skip to main content
Module

x/typestruct/mod.ts>nonpositive

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

Create non-positive value struct. Ensure the input is non-positive number. Non-positive number means less than or equal to zero.

Examples

Example 1

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

assertEquals(is(nonpositive(), 0), true);
assertEquals(is(nonpositive(), -1), true);
assertEquals(is(nonpositive(), 1), false);

Parameters

optional
message: string

Custom issue message.