← All packages

API reference

@searsuite/sear-foundation-utils

General-purpose algorithms and guards without editor-domain ownership.

13 exportsderived from source

typeHexColorsource ↗
type HexColor = templateLiteral

Type contract for HexColor.

variableStandardColorsource ↗
StandardColor: { Black: "#000000" }

Standard opaque colors shared by renderers and host adapters.

functioncolumnIndexToLabelsource ↗
columnIndexToLabel(columnIndex: number): string

Converts a zero-based column index to an Excel-style label (A, Z, AA, ...).

Example
columnIndexToLabel(0) // 'A'
columnIndexToLabel(26) // 'AA'
columnIndex: number
functioncolumnLabelToIndexsource ↗
columnLabelToIndex(label: string): number

Converts an Excel-style column label (A, Z, AA, ...) to a zero-based index.

Example
columnLabelToIndex('A') // 0
columnLabelToIndex('AA') // 26
label: string
functionerfsource ↗
erf(value: number): number

Evaluates erf without the error floor of short polynomial approximations.

value: number
functionerfcsource ↗
erfc(value: number): number

Evaluates erfc directly in the positive tail to preserve small probabilities.

value: number
functiongetRandomColorsource ↗
getRandomColor(): templateLiteral | null

Generates a random color in hexadecimal format. Ensures no duplicate colors until all colors are exhausted.

ReturnsA random hexadecimal color string, or null if all colors used.

functionisFormulaErrorsource ↗
isFormulaError<T>(value: T): value

Type guard for formula error-shaped values.

value: T
functionisFormulaTextsource ↗
isFormulaText<T>(value: T): value

Returns whether a value carries text-specific formula coercion semantics.

value: T
functionisNumbersource ↗
isNumber(value: unknown): value

Returns whether a value is a JavaScript number.

value: unknown
functionreleaseColorsource ↗
releaseColor(color: templateLiteral): boolean

Release a color back to the available pool

color: templateLiteral
functiontoNumberOrErrorsource ↗
toNumberOrError(value: unknown): number | { code: "#VALUE!"; kind: "error" }

Converts a value for scalar arithmetic, returning an Excel #VALUE! error when invalid.

value: unknown
functiontoNumberOrZerosource ↗
toNumberOrZero(value: unknown): number

Converts a formula value for aggregate functions; non-numeric values are 0.

value: unknown