apps-script-utils 2.1.1 Help

isCountable

function isCountable(value: unknown): value is number;

A value that can serve as a quantity, a length or a zero-based index: a whole number, not negative, and small enough that integer arithmetic on it is still exact.

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 a countable number; otherwise false.

In TypeScript the guard narrows value to number inside the branch.

Examples

What passes and what does not

isCountable(0); // => true isCountable(42); // => true isCountable(-1); // => false isCountable(1.5); // => false isCountable(Number.MAX_SAFE_INTEGER + 2); // => false

See also

Source

src/lang/number/isCountable.ts

23 September 2026

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