← All packages

API reference

@searsuite/sear-foundation-range

Range primitives and normalization helpers used by Sheet and Doc domains.

1 exportsderived from source

classRangesource ↗
class Range

Parses and represents an Excel-style rectangular range.

The public coordinates are one-based because the string format is A1-based, while column conversion delegates to the shared zero-based label utilities.

constructorconstructor
Range(range: string): Range

Constructs a range from an A1-style string.

range: string

Range string in the form A1:B2.

memberrange
range: unknown
membershape
shape: unknown
methodcontains
contains(x: number, y: number): boolean

Tests whether a one-based coordinate is inside this range.

ReturnsTrue when the coordinate falls inside the range.

x: number

One-based column coordinate.

y: number

One-based row coordinate.

methodtoString
toString(): string

Serializes the range back to A1 notation.

methodcolumnToNumberstatic
columnToNumber(column: string): number

Converts an Excel-style column label to a one-based column number.

ReturnsOne-based column number.

column: string

Column label such as A or AA.

methodnumberToColumnstatic
numberToColumn(number: number): string

Converts a one-based column number to an Excel-style label.

ReturnsColumn label such as A or AA.

number: number

One-based column number.