Function: idsToStrings()
idsToStrings(
c):IdColumnResult
Defined in: src/core/int64.ts:111
The id rule over one column, in place. When every non-null cell is a decimal
string, an integer that converts exactly (a bigint, or a safe-integer number:
INT32, INT64, or a DOUBLE holding 123 -> "123", never "123.0"; -0 ->
"0"), a NaN (a missing DOUBLE -> null), or a list of those, every integer
becomes its decimal string. Otherwise the column is left as read (a NaN still
becomes null) and the result is "not-integers": a fraction, a boolean, an
object, or a number past 2^53 (a double there is not an exact id, so a string
of it would be a wrong id).
Parameters
c
The column, e.g. rowCells(rows, col); mutated in place through
c.set. Lists are converted element-wise (recursively).
Returns
"strings" when the integers were converted, "unchanged" when there were only
strings / nulls / empty lists, "not-integers" when a cell blocked conversion.
Remarks
All-or-nothing per column: one fraction leaves every integer in the column as read.
NaN becomes null in both the "strings" and "not-integers" cases. null, undefined
and strings are never written back.
Example
import { rowCells, idsToStrings } from "./int64.js";
const mixed = [{ game_id: 401585607 }, { game_id: 401628579n }, { game_id: 39.0 }, { game_id: NaN }];
idsToStrings(rowCells(mixed, "game_id")); // "strings"
mixed.map((r) => r.game_id); // ["401585607", "401628579", "39", null]
idsToStrings(rowCells([{ id: 1.5 }, { id: 2 }], "id")); // "not-integers" (2 stays a number)