@flighter/a1-notation
v2.2.1
Published
Work with A1 notation like "A1" or "A1:B2"
Downloads
2,930
Maintainers
Readme
A1 notation
About
This library is for working with A1 notations such as "A1" or "A1:B2". The library is exported as a ES module.
Install
npm i @flighter/a1-notation -d
Or
yarn add @flighter/a1-notation
Download
What is the difference?
- converter 1 or converter 2? The difference is in the algorithm of convertation. You can compare the first method with the second method.
- ".min"? Minified version.
- Default version in npm is ESM. This version is not transpiled and minified, so you need to transpile and minify it.
Initialization
import A1 from '@flighter/a1-notation';
API
Note: A1 string could be represented in any register. A1 === a1
, A1:B2 === a1:b2 === A1:b2 === a1:B2
- static isValid(a1: string): boolean
- static getCol(a1: string, converter: 1 | 2 = 1): number
- static getLastCol(a1: string, converter: 1 | 2 = 1): number
- static getRow(a1: string): number
- static getLastRow(a1: string): number
- static getWidth(a1: string, converter: 1 | 2 = 1): number
- static getHeight(a1: string): number
- static toCol(col: number): string
- static toRow(row: number): string
- constructor
- get(): string
- toString(): string
- toJSON(): result
- getCol(): number
- getLastCol(): number
- getRow(): number
- getLastRow(): number
- getWidth(): number
- getHeight(): number
- setCol(val: string | number): this
- setLastCol(val: string | number): this
- setRow(val: string | number): this
- setLastRow(val: string | number): this
- copy(): A1
- addX(count: number): this
- addY(count: number): this
- add(countX: number, countY: number): this
- removeX(count: number): this
- removeY(count: number): this
- remove(countX: number, countY: number): this
- shiftX(offset: number): this
- shiftY(offset: number): this
- shift(offsetX: number, offsetY: number): this