Table Parser Base Utilities

0.0.5 · active · verified Sun Apr 19

table-parser-base is a lightweight JavaScript utility library designed to facilitate the transformation of tabular data structures. Primarily, it offers functions to convert between an `ArrayTable` format (an object with separate `headers` and `rows` arrays) and an `ObjectTable` format (an array of objects, where each object represents a row). Currently at version 0.0.5, the package is in a very early stage of development, implying an ad-hoc release cadence without a fixed schedule and potential for rapid iteration on its API. Its core differentiation lies in providing simple, focused, and stream-capable utilities for these specific table data model conversions, often serving as foundational components for broader data parsing or manipulation pipelines. It emphasizes an asynchronous, iterable approach for processing object tables, which is suitable for potentially large datasets.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to import and use `createObjectTable` to transform an array-based table structure into an iterable object-based table, logging each row.

import { createObjectTable } from 'table-parser-base'

const arrayTable = {
  headers: ['id', 'name', 'email'],
  rows: [
    [1, 'John Doe', 'john-doe@gmail.com'],
    [2, 'Peter Smith', 'petersmith22@outlook.com'],
    [3, 'Julia Jones', 'jjones778@gmail.com']
  ]
}

async function processTable() {
  const objectTable = await createObjectTable(arrayTable)
  console.log('--- Converted to ObjectTable ---')
  for await (const item of objectTable) {
    console.log(item)
  }
}

processTable()

view raw JSON →