Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

basic-csv-parser

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

basic-csv-parser

lightweight (1kb gzip, no dependencies) csv string parser for the browser

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

basic-csv-parser

NPM

lightweight (1kb gzip, no dependencies) csv string parser for the browser, validated against an applicable subset of the PapaParse test suite.

Example

check this codesandbox

API v1

/**
 * @return a csv string parser as specified by the given `config` options object
 */
export declare function getCsvParser<T = string[]>(
  config?: Partial<CSV_PARSER_SPEC>
): (input: string) => T[]

export interface CSV_PARSER_SPEC {
  /**
   * when true, the first line is interpreted as a header (list of field names),
   * in which case the parsed entries are objects
   * instead of a list of field values.
   * default: false
   */
  header: boolean
  /**
   * field delimiter character,
   * default: `,`
   */
  delimiter: string
  /**
   * escape character,
   * default: `"`
   */
  escape: string
  /**
   * called for each parsed field,
   * with its index in the parsed record.
   * defaults to a function that unescapes the field string
   */
  postprocess: (field: string, index?: number) => string
}

TypeScript

although this library is written in TypeScript, it may also be imported into plain JavaScript code: code editors will still benefit from the available type definition, e.g. for helpful code completion.

License

Copyright 2019 ZenyWay S.A.S., Stephane M. Catala

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and Limitations under the License.

Keywords

FAQs

Package last updated on 03 Dec 2019

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc