INNER CODE UNIT · TypeScript
FileContents
dtinth/todo-actions · src/File.ts:43
export class FileContents implements IFileContents {
lines: string[]
changed: boolean
constructor(contents: string) {
this.lines = contents.split('\n')
this.changed = false
}
changeLine(lineIndex: number, newLineContents: string) {
this.lines[lineIndex] = newLineContents
this.changed = true
}
toString() {
return this.lines.join('\n')
}
}