import { chars } from './utils.ts'; export class Row { chars: string[] = []; constructor(s: string = '') { this.chars = chars(s); } public toString(): string { return this.chars.join(''); } } export class Document { #rows: Row[]; private constructor() { this.#rows = []; } get numrows(): number { return this.#rows.length; } public static empty(): Document { return new Document(); } public static open(_filename: string): Document { const doc = new Document(); const line = 'Hello, World!'; const row = new Row(line); doc.#rows.push(row); return doc; } public getRow(i: number): Row | null { if (this.#rows[i] !== undefined) { return this.#rows[i]; } return null; } } export default Document;