@searsuite/sear-foundation-utils
General-purpose algorithms and guards without editor-domain ownership.
Column labels
- functioncolumnIndexToLabel
-
columnIndexToLabel(columnIndex: number): stringConverts a zero-based column index to an Excel-style label (A, Z, AA, ...).
ExamplecolumnIndexToLabel(0) // 'A' columnIndexToLabel(26) // 'AA' - functioncolumnLabelToIndex
-
columnLabelToIndex(label: string): numberConverts an Excel-style column label (A, Z, AA, ...) to a zero-based index.
ExamplecolumnLabelToIndex('A') // 0 columnLabelToIndex('AA') // 26
Colors
- typeHexColor
-
type HexColor = templateLiteral - variableStandardColor
-
StandardColor: { Black: "#000000" }Standard opaque colors shared by renderers and host adapters.
- functiongetRandomColor
-
getRandomColor(): templateLiteral | nullGenerates 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.
- functionreleaseColor
-
releaseColor(color: templateLiteral): booleanRelease a color back to the available pool
Numeric helpers
- functionerf
-
erf(value: number): numberEvaluates erf without the error floor of short polynomial approximations.
- functionerfc
-
erfc(value: number): numberEvaluates erfc directly in the positive tail to preserve small probabilities.
- functionisFormulaError
-
isFormulaError<T>(value: T): valueType guard for formula error-shaped values.
- functionisFormulaText
-
isFormulaText<T>(value: T): valueReturns whether a value carries text-specific formula coercion semantics.
- functionisNumber
-
isNumber(value: unknown): valueReturns whether a value is a JavaScript number.
- functiontoNumberOrError
-
toNumberOrError(value: unknown): number | { code: "#VALUE!"; kind: "error" }Converts a value for scalar arithmetic, returning an Excel #VALUE! error when invalid.
- functiontoNumberOrZero
-
toNumberOrZero(value: unknown): numberConverts a formula value for aggregate functions; non-numeric values are 0.
No matching API entries.