Files
languageservices/actions-expressions/src/idxHelper.ts
T
2023-01-09 19:02:19 -05:00

21 lines
472 B
TypeScript

import {ExpressionData} from "./data";
export class idxHelper {
public readonly str: string | undefined;
public readonly int: number | undefined;
constructor(public readonly star: boolean, idx: ExpressionData | undefined) {
if (!star) {
if (idx!.primitive) {
this.str = idx!.coerceString();
}
let f = idx!.number();
if (!isNaN(f) && isFinite(f) && f >= 0) {
f = Math.floor(f);
this.int = f;
}
}
}
}