license import { Dataset } from '../dataset' ; import { DataSource } from '../datasource' ; import { LazyIterator } from '../iterators/lazy_iterator' ; /**
 * Represents a potentially large collection of text lines.
 *
 * The results are not batched.
 */ export class TextLineDataset extends Dataset < string > { param input constructor ( protected readonly input ) { super ( ) ; } async iterator ( ) { const inputIterator = await this . input . iterator ( ) ; const utf8Iterator = inputIterator . decodeUTF8 ( ) ; const lineIterator = utf8Iterator . split ( '\n' ) . map ( line => { if ( line . endsWith ( '\r' ) ) { line = line . slice ( 0 , - 1 ) ; } return line ; } ) ; return lineIterator ; } }