Coder Social home page Coder Social logo

elm-csv-decode's Introduction

Csv.Decode

CSV decoding, heavily inspired by url-parser.

Note this library does not include an underlying CSV parser. It assumes you are using something like periodic/elm-csv or lovasoa/elm-csv to get from String to Csv, where Csv is:

type alias Csv =
  { headers : List String
  , records : List (List String)
  }

This library gets you the rest of the way, to a list of your own types. It also collects errors together with the index of the record they occurred on.

You can think of this as analogous to Json.Decode. It lets you declaratively convert data from an intermediate representation (Json.Value or Csv) into your own types.

Basic usage

Using periodic/elm-csv (which returns a Result (List String) Csv):

Csv.parse rawData |> Csv.Decode.decode myDecoder

Using lovasoa/elm-csv (which returns a plain Csv):

Csv.parse rawData |> Csv.Decode.decodeCsv myDecoder

You can define decoders based on field position or on header name. See examples in the docs.

elm-csv-decode's People

Contributors

ap-nri avatar ericgj avatar tesk9 avatar

Watchers

 avatar

Forkers

kfabryczny

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.