web-csv-toolbox
    Preparing search index...

    Class RecordAssemblerTransformer<Header>

    A transform stream that converts a stream of tokens into a stream of rows.

    The options for the parser.

    new ReadableStream({
    start(controller) {
    controller.enqueue("name,age\r\n");
    controller.enqueue("Alice,20\r\n");
    controller.enqueue("Bob,25\r\n");
    controller.enqueue("Charlie,30\r\n");
    controller.close();
    })
    .pipeThrough(new LexerTransformer())
    .pipeThrough(new RecordAssemblerTransformer())
    .pipeTo(new WritableStream({ write(row) { console.log(row); }}));
    // { name: "Alice", age: "20" }
    // { name: "Bob", age: "25" }
    // { name: "Charlie", age: "30" }
    new ReadableStream({
    start(controller) {
    controller.enqueue("Alice,20\r\n");
    controller.enqueue("Bob,25\r\n");
    controller.enqueue("Charlie,30\r\n");
    controller.close();
    }
    })
    .pipeThrough(new LexerTransformer())
    .pipeThrough(new RecordAssemblerTransformer({ header: ["name", "age"] }))
    .pipeTo(new WritableStream({ write(row) { console.log(row); }}));
    // { name: "Alice", age: "20" }
    // { name: "Bob", age: "25" }
    // { name: "Charlie", age: "30" }

    Type Parameters

    • Header extends ReadonlyArray<string>

      The type of the header row.

    Hierarchy

    Index

    Constructors

    Properties

    Constructors

    Properties

    assembler: RecordAssembler<Header>
    writable: WritableStream<Token[]>