Skip to main content
Module

x/isx/mod.ts>isNonNegativeInteger

TypeScript-first is function collections
Go to Latest
function isNonNegativeInteger
import { isNonNegativeInteger } from "https://deno.land/x/isx@1.0.0-beta.22/mod.ts";

Whether the value is non negative integer or not.

Parameters

value: number
  • Any number.
import { isNonNegativeInteger } from "https://deno.land/x/isx@$VERSION/mod.ts"
import { assertEquals } from "https://deno.land/std@$VERSION/testing/asserts.ts"
assertEquals(isNonNegativeInteger(0), true)
assertEquals(isNonNegativeInteger(1.0), true)
assertEquals(isNonNegativeInteger(-1), false)

Returns

boolean