entries

Expands a sheet into a flat list of entries in ascending key order, each row left to right.

import { Sheet } from "@teakit/sheet";

Sheet.entries({ b: [3], a: [1, 2] });
// [
//   { key: "a", rowIndex: 0, colIndex: 0, value: 1 },
//   { key: "a", rowIndex: 0, colIndex: 1, value: 2 },
//   { key: "b", rowIndex: 1, colIndex: 0, value: 3 },
// ]

API Reference

Signature

Sheet.entries<T, TKey extends string>(
  sheet: Sheet<T, TKey>,
): SheetEntry<T, TKey>[];
// SheetEntry: { key, rowIndex, colIndex, value }

Parameters

ParameterTypeRequiredNotes
sheetSheet<T, TKey>YesSource sheet.

Returns

An array of { key, rowIndex, colIndex, value }, ordered by ascending key then column. rowIndex follows the ascending key order.

Throws

Does not throw.

Agent Contract

FieldValue
Kindstatic traversal
Canonical nameentries
AliasesNone
Mutates inputsNo
ReturnsSheetEntry<T, TKey>[]

Agent Notes

  • entries uses colIndex; the inverse, fromEntries, uses index to place values back into rows.
  • The shapes differ: entries returns SheetEntry, fromEntries consumes SheetEntryInput.