bitbybit.dev v1.0.0-rc.1
    Preparing search index...

    Class CSVBitByBit

    Index

    Constructors

    generate

    • Converts a 2D array to CSV text. Example: array=[['name','age'], ['John','30']] → 'name,age\nJohn,30'

      Parameters

      Returns string

      CSV text

      array to csv

      false

    • Converts an array of JSON objects to CSV text. Example: json=[{'name':'John','age':'30'}], headers=['name','age'] → 'name,age\nJohn,30'

      Type Parameters

      • T = Record<string, unknown>

      Parameters

      • inputs: JsonToCsvDto<T>

        JSON array, headers, and formatting options

      Returns string

      CSV text

      json to csv

      false

    • Converts an array of JSON objects to CSV text using object keys as headers. Example: json=[{'name':'John','age':'30'}] → 'name,age\nJohn,30'

      Type Parameters

      • T = Record<string, unknown>

      Parameters

      Returns string

      CSV text

      json to csv auto

      false

    parse

    • Parses CSV text to a 2D array of strings (rows and columns). Example: csv='a,b,c\n1,2,3' → [['a','b','c'], ['1','2','3']]

      Parameters

      Returns string[][]

      2D array of strings

      parse to array

      false

    • Parses CSV text to an array of JSON objects using headers. Example: csv='name,age\nJohn,30\nJane,25', headerRow=0, dataStartRow=1 → [{'name':'John','age':'30'}, {'name':'Jane','age':'25'}]

      Type Parameters

      • T = Record<string, string | number>

      Parameters

      Returns T[]

      Array of JSON objects

      parse to json

      false

    • Parses CSV text to JSON using custom headers (ignores CSV headers if present). Example: csv='John,30\nJane,25', headers=['name','age'] → [{'name':'John','age':'30'}, {'name':'Jane','age':'25'}]

      Type Parameters

      • T = Record<string, string | number>

      Parameters

      Returns T[]

      Array of JSON objects

      parse to json with headers

      false

    query

    • Queries CSV data by column/header name and returns all values in that column. Example: csv='name,age\nJohn,30\nJane,25', column='name' → ['John', 'Jane']

      Type Parameters

      • T = Record<string, string | number>

      Parameters

      Returns (string | number)[]

      Array of values from the specified column

      query column

      false

    • Queries CSV data and filters rows where a column matches a value. Example: csv='name,age\nJohn,30\nJane,25', column='age', value='30' → [{'name':'John','age':'30'}]

      Type Parameters

      • T = Record<string, string | number>

      Parameters

      Returns T[]

      Array of matching rows as JSON objects

      query rows by value

      false

    • Gets the headers from a CSV file. Example: csv='name,age\nJohn,30', headerRow=0 → ['name', 'age']

      Parameters

      Returns string[]

      Array of header names

      get headers

      false

    • Gets the number of rows in a CSV file (excluding headers if specified). Example: csv='name,age\nJohn,30\nJane,25', headerRow=0 → 2

      Parameters

      Returns number

      Number of data rows

      row count

      false

    • Gets the number of columns in a CSV file. Example: csv='name,age,city\nJohn,30,NYC' → 3

      Parameters

      Returns number

      Number of columns

      column count

      false