Socket
Book a DemoInstallSign in
Socket

@appvise/format-csv

Package Overview
Dependencies
Maintainers
3
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@appvise/format-csv

Simple CSV encoder/decoder

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
3
Created
Source

@appvise/format-csv

Simple CSV encoder/decoder

Usage

import { encode, decode } from '@appvise/format-csv';

// {subject:"world",greeting:"hello"}
const data = decode(`
subject,greeting
world,hello
`);

const recoded = encode(data);

console.log({
  data,
  recoded,
});

// {
//   data: [ { subject: 'world', greeting: 'hello' } ],
//   recoded: '"subject","greeting"\n"world","hello"'
// }

API Reference

  • encode(data: CsvData, opts: CsvEncodeOptions = {}): string
  • decode(str: string, opts: CsvDecodeOptions = {}): CsvData
  • type CsvData = ({[index:string]:string|number|boolean}|[string|number|boolean])[]
  • type CsvEncodeOptions = {
      delimiter?: string,
      wrapString?: string,
    }
    
  • type CsvDecodeOptions = {
      delimiter?    : string,
      wrapString?   : string,
      parseNumbers? : boolean,
      parseHeaders? : boolean,
      parseBooleans?: boolean,
      headers?      : string[],
    }
    

FAQs

Package last updated on 05 Oct 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts