web-csv-toolbox - v0.14.0
    Preparing search index...

    Type Alias ColumnCountStrategy

    ColumnCountStrategy: "keep" | "pad" | "strict" | "truncate"

    Strategy for handling column count mismatches between header and data rows.

    Available strategies:

    • 'keep': Output rows as-is with their actual length
      • Array format: Row length varies, no padding or truncation
      • Object format: Treated as 'pad' (all header keys present, missing values = undefined)
    • 'pad': Ensure all rows match header length
      • Array format: Pad short rows with undefined, truncate long rows
      • Object format: All header keys present, missing values = undefined, extra values ignored
    • 'strict': Enforce exact header length match
      • Both formats: Throws error if row length ≠ header length
    • 'truncate': Handle long rows only, keep short rows as-is
      • Array format: Truncate long rows to header length, keep short rows unchanged
      • Object format: All header keys present (like 'pad'), missing values = undefined

    Default values:

    • Array format: 'keep'
    • Object format: 'pad'

    Headerless CSV behavior: When no header is provided (header: undefined or header: []):

    • The strategy option is accepted but effectively behaves as 'keep'
    • All rows maintain their actual length with no validation
    • For explicit headerless mode (header: []), only 'keep' is allowed at runtime
    // Header: ['name', 'age', 'city']
    // Input row: 'Alice,30'
    // outputFormat: 'array'

    // keep → ['Alice', '30'] (short row kept as-is)
    // pad → ['Alice', '30', undefined] (padded to match header)
    // strict → Error thrown (length mismatch)
    // truncate → ['Alice', '30'] (short row kept as-is, only truncates long rows)
    // Header: ['name', 'age', 'city']
    // Input row: 'Alice,30'
    // outputFormat: 'object'

    // keep → { name: 'Alice', age: '30', city: undefined } (treated as 'pad')
    // pad → { name: 'Alice', age: '30', city: undefined } (all keys present)
    // strict → Error thrown (length mismatch)
    // truncate → { name: 'Alice', age: '30', city: undefined } (all keys present)