Table.Value

Generated from docs.json. 4 exposed values, types, and type aliases, in the order the module exposes them.

The one union type for cell values.

Column accessors return a Value. Built-in sort, filter, and aggregation functions operate on Value. Custom sort and filter functions receive the original row instead, so users are never forced through Value for their own logic.

Null stands in for both JavaScript null and undefined. List is the Elm counterpart of a JavaScript array cell value and exists so the array filter functions (arrIncludes, arrIncludesAll, arrIncludesSome) and the extent / unique aggregations can be expressed faithfully.

Type

Value

type Value
    = String String
    | Number Float
    | Bool Bool
    | Date Time.Posix
    | List List Table.Value.Value
    | Null

A cell value.

Helpers

toString

toString : Table.Value.Value -> String

Coerce a value to a string the way JavaScript's String(x) does, except that Null becomes the empty string (TanStack writes String(x ?? '') at every call site that matters).

toString (Number 1) == "1"

toString (Number 1.5) == "1.5"

toString (Bool True) == "true"

toString Null == ""

toNumber

toNumber : Table.Value.Value -> Float

Coerce a value to a number the way JavaScript's Number(x) does.

toNumber (Number 29) == 29

toNumber (String "29") == 29

toNumber (String "") == 0

toNumber (Bool True) == 1

toNumber Null == 0

A value that does not coerce, such as String "abc", gives NaN, which compares False against everything just as it does in JavaScript. A Date coerces to its millisecond timestamp and a one-element List coerces to its element, both matching Number(x).

isNull

isNull : Table.Value.Value -> Bool

True only for Null.