Skip to main content

Module value

Module value 

Source
Expand description

The value shape validates: what JSON can carry, plus the four things the canonical behaviour needs and JSON cannot say (an absent value, NaN, a date, a bigint), with object keys in insertion order.

Enums§

Value
A value under validation, or produced by it.

Constants§

ERR_VALUE_LIMIT
The limit a rendered value is clipped to in a message.

Functions§

is_integer
Whether a number is an integer as Number.isInteger judges it.
js_date_string
A date as Date.prototype.toISOString prints it: UTC, millisecond precision.
js_number
A number as JavaScript’s Number.prototype.toString prints it: the shortest digits that read back as the same double, an integer without a point, an exponent below 1e-6 and from 1e21.
json_render
A value as JSON.stringify prints it after shape’s replacer: keys in insertion order, no spaces, NaN as the text NaN, an undefined element as null and an undefined property omitted, a date as its ISO text.
json_text
A string as JSON.stringify prints it, quotes included: no HTML escaping.
truncate_text
Clip a rendering to limit characters, the last three an ellipsis.
value_kind
The kind a message calls a value: “value” for nothing, null or NaN, otherwise its typeof, with arrays told from objects.
value_to_string
A value as a message names it: its JSON with the quotes stripped, clipped.

Type Aliases§

Map
An object: keys in insertion order, as a JavaScript object keeps them.