lang holds the language-level utilities — the parts of the library that know nothing about Google Apps Script and run anywhere JavaScript does.
Packages
Package
Covers
lang/base
the isX/nonX/requireX guards for the built-in types
lang/array
array shape checks and transforms
lang/number
numeric classification and conversion
lang/object
hashing and string conversion
lang/string
case conversion, validation, and version comparison
The library also ships html, json, and time as sibling packages. They are runtime-independent in the same way and are listed alongside lang in Base utilities.
Type guards
lang/base is the largest package and the one most code touches. It is documented in full in Validation conventions; in short, isX and nonX answer questions, requireX validates and returns.
import { requireString, toKebabCase } from "apps-script-utils";
function slugify(input: unknown): string {
return toKebabCase(requireString(input));
}
isConsistent2DArray is the check worth making before writing to a sheet: Range.setValues() requires every row to have the same length, and a ragged array fails at the service boundary with a message that does not say which row was wrong.
Numbers
import { isCountable, isFloat, isInteger, toInteger } from "apps-script-utils";
isInteger(42); // true
isInteger(42.5); // false
isFloat(42.5); // true
isCountable(3); // true — a non-negative whole number
isCountable(-1); // false
Row and column arguments in the Sheets API are counts, not arbitrary numbers, which is what isCountable and requireCountable are for.
objectToString reports the internal tag rather than String(value), which makes it the reliable way to tell an array from a date from a plain object — and the tag survives crossing a frame boundary, where instanceof does not.
Full list
Base utilities lists every function in lang, html, json, and time with its return type and a link to its source.