Skip to main content

isNull

Validates if the supplied input is null.

caution

Please consider the use of null. TypeScript has two bottom types: null and undefined. They are intented to mean different things:

  • Something hasn't been initialized: undefined
  • Something is current unavailable: null

Most other languages only have one (commonly called null). Since by default JavaScript will evaluate an uninitialized variable/parameter/property to undefined (you don't get a choice) we recommend you just use that for your own unavailable status and don't bother with null.

Signature

isNull(input: any): boolean

Parameters

NameTypeOptionalDescription
inputanyNoInput to validate.

Return value

Returns true if the input is null.

Example

import { isNull } from "@tripetto/runner";

isNull(null); // Returns `true`
isNull(undefined); // Returns `true`
isNull({}); // Returns `false`