f7
f7 is a spreadsheet formula execution library
git clone https://git.vogt.world/f7.git
Log | Files | README.md | LICENSE.md
← All files
name: src/main/js/formulas/parser/TO_TEXT.ts
-rw-r--r--
772
 1import { F7Exception } from "../../errors/F7Exception";
 2import { SheetColumnRowKey } from "../../models/common/SheetColumnRowKey";
 3import { Complex } from "../../models/common/Types";
 4import { Converters } from "../../utils/Converters";
 5import { AbstractFormula } from "../AbstractFormula";
 6import { FormulaName } from "../FormulaName";
 7
 8export class TO_TEXT extends AbstractFormula {
 9  static SELF: TO_TEXT = new TO_TEXT();
10  NAME = FormulaName.TO_TEXT;
11
12  internal(origin: SheetColumnRowKey, ...values: Array<Complex>) {
13    AbstractFormula.checkLength(values.length, 1, this.NAME);
14    const first = Converters.first(this.collateralLookup(origin, values[0]));
15    if (first instanceof F7Exception) {
16      return first;
17    }
18    return Converters.toText(first);
19  }
20}