apps-script-utils 2.1.1 Help

isNumberLike

function isNumberLike(value: unknown): boolean;

A finite number, or a string that converts to one. NaN, the infinities and the empty string are excluded, which is what separates this from a bare Number(value).

isX and nonX answer a question and never interrupt control flow; requireX and requireNonX hand the value back or throw. The scheme is explained in Validation conventions.

Parameters

Parameter

Type

Description

value

unknown

The value to check.

Returns

boolean — true when the value is convertible to a number; otherwise false.

Examples

What passes and what does not

isNumberLike(1); // => true isNumberLike("1.5"); // => true isNumberLike(" 42 "); // => true isNumberLike(NaN); // => false isNumberLike(Infinity); // => false isNumberLike(""); // => false isNumberLike(null); // => false

See also

Source

src/lang/base/isNumberLike.ts

23 September 2026

This documentation was generated with AI (Claude) from the library's source code.