Socket
Socket
Sign inDemoInstall

@appvise/format-csv

Package Overview
Dependencies
0
Maintainers
3
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @appvise/format-csv

Simple CSV encoder/decoder


Version published
Maintainers
3
Install size
12.1 kB
Created

Readme

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

Last updated on 05 Oct 2021

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc