{"id":21722044,"url":"https://github.com/group4layers/csv-types-js","last_synced_at":"2026-05-20T19:02:52.778Z","repository":{"id":83186694,"uuid":"109248077","full_name":"Group4Layers/csv-types-js","owner":"Group4Layers","description":"CSV Types (csv-types-js) is a JavaScript library to parse CSV strings (comma separated values and text files with fields delimited by a character) and produce a JavaScript AST (abstract syntax tree) with the data. It also supports types specs: multiple headers-values (tables) per csv string.","archived":false,"fork":false,"pushed_at":"2022-04-26T05:08:00.000Z","size":564,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-26T10:48:13.765Z","etag":null,"topics":["csv","csv-parser","csv-types","data-processing","flextable","javascript","nodejs","parser"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/csv-types","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Group4Layers.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-11-02T10:07:52.000Z","updated_at":"2022-04-22T05:52:47.000Z","dependencies_parsed_at":"2023-03-22T01:32:51.102Z","dependency_job_id":null,"html_url":"https://github.com/Group4Layers/csv-types-js","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Group4Layers%2Fcsv-types-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Group4Layers%2Fcsv-types-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Group4Layers%2Fcsv-types-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Group4Layers%2Fcsv-types-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Group4Layers","download_url":"https://codeload.github.com/Group4Layers/csv-types-js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244694403,"owners_count":20494641,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["csv","csv-parser","csv-types","data-processing","flextable","javascript","nodejs","parser"],"created_at":"2024-11-26T02:20:38.456Z","updated_at":"2026-05-20T19:02:47.724Z","avatar_url":"https://github.com/Group4Layers.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CSV Types (csv-types-js)\n\n[![JavaScript](https://img.shields.io/badge/made_in-javascript-fed93d.svg?style=flat-square)](https://developer.mozilla.org/docs/Web/JavaScript) [![License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](https://github.com/Group4Layers/csv-types-js/blob/master/LICENSE.md) [![Coverage](https://img.shields.io/badge/coverage-98.7%25-green.svg)](https://github.com/Group4Layers/csv-types-js) [![Tests](https://img.shields.io/badge/tests-42%2F42-green.svg)](https://github.com/Group4Layers/csv-types-js)\n\nCSV Types (csv-types-js) is a JavaScript library to parse CSV strings (comma separated values and text files with fields delimited by a character) and produce a JavaScript AST (abstract syntax tree) with the data. It also supports *types specs*: multiple headers-values (tables) per csv string.\n\nOnline tools: [![Build Status](https://travis-ci.org/Group4Layers/csv-types-js.svg?branch=master)](https://travis-ci.org/Group4Layers/csv-types-js) [![Coverage Status](https://coveralls.io/repos/github/Group4Layers/csv-types-js/badge.svg?branch=master)](https://coveralls.io/github/Group4Layers/csv-types-js?branch=master) [![SourceLevel](https://app.sourcelevel.io/github/Group4Layers/-/csv-types-js.svg)](https://app.sourcelevel.io/github/Group4Layers/-/csv-types-js) [![Inline Docs](https://inch-ci.org/github/Group4Layers/csv-types-js.svg)](https://inch-ci.org/github/Group4Layers/csv-types-js)\n\nThis library is commonly used with [FlexTable](https://github.com/Group4Layers/flextable) to facilitate the data manipulation produced by CSV Types (the data structure is consumed by FlexTable).\n\n### [Repo](https://github.com/Group4Layers/csv-types-js) \u0026nbsp;\u0026nbsp; [Docs](https://group4layers.github.io/csv-types-js/) \u0026nbsp;\u0026nbsp; [NPM package](https://www.npmjs.com/package/csv-types)\n\n## Table of Contents\n\n1. [Description](#description)\n1. [Installation](#installation)\n1. [Examples](#examples)\n1. [Options](#options)\n1. [Group4Layers use case (or why CSV Types)](#group4layers-use-case-or-why-csv-types)\n1. [Test \u0026 Coverage](#test--coverage)\n1. [New features](#new-features)\n1. [Author](#author)\n1. [ChangeLog](#changelog)\n1. [License](#license)\n\n## Description\n\nCSV Types (csv-types-js) is a JavaScript library to parse CSV strings (comma separated values and text files with fields delimited by a character) and produce a JavaScript AST (abstract syntax tree) with the data. It also supports *types specs*: multiple headers-values (tables) per csv string.\n\nIt parses four types of CSV formats, being the first two common between different applications and parsers, but have disadvantages over the last two that we are using in Group4Layers.\n\nFormat 1: **Values**.\n\n```csv\nevent,2017-01-03,sport,running,minutes,35\nevent,2017-02-05,sport,press bench,kg,85-100-104-106-106\nevent,2017-02-05,sport,press bench,repetitions,12-10-10-8-7\nevent,2017-02-07,sport,pull-up,repetitions,12-12-10-10-10\n```\n\nFormat 2: **Header** and **values**.\n\n```csv\ndate,activity,action,units,value\n2017-01-03,sport,running,minutes,35\n2017-02-05,sport,press bench,kg,85-100-104-106-106\n2017-02-05,sport,press bench,repetitions,12-10-10-8-7\n2017-02-07,sport,pull-up,repetitions,12-12-10-10-10\n```\n\nFormat 3: Allow **comments**, **header is commented** and **values**. Now you can provide more info, avoid confusing values with comments and headers (using a highlighter editor/viewer like *Emacs*) easing the interpretation and modification.\n\n```csv\n#date,activity,action,units,value\n2017-01-03,sport,running,minutes,35\n# I slept just 5 hours\n2017-02-05,sport,press bench,kg,85-100-104-106-106\n2017-02-05,sport,press bench,repetitions,12-10-10-8-7\n# I had some pain in my right shoulder\n# the gym was closed 2017-02-06, so, I work-out the next day\n2017-02-07,sport,pull-up,repetitions,12-12-10-10-10\n```\n\nFormat 4: **Types specs**: **comments**, **multiple commented headers** and **multiple type of values**. Now you can provide CSV files that are self-contained, with multiple type of values in the same file. It is flexible and you can alter the number of columns in the future, improving the expressivity of the data. It has the advantages of the previous format but with the maximum flexibility (multiple tables in the same file).\n\n```csv\n#type-sport,date,activity,action,units,value\n#type-sleep,date,hours\ntype-sport,2017-01-03,sport,running,minutes,35\ntype-sleep,2017-02-05,5\ntype-sport,2017-02-05,sport,press bench,kg,85-100-104-106-106\ntype-sport,2017-02-05,sport,press bench,repetitions,12-10-10-8-7\n#type-body-condition,part,severity,description\ntype-body-condition,right shoulder,high,concentrated pain in the back part of my right shoulder\n# the gym was closed 2017-02-06, so, I work-out the next day\ntype-sport,2017-02-07,sport,pull-up,repetitions,12-12-10-10-10\n```\n\nA real-world example of this format (Types specs) can be seen in section [Group4Layers use case (or why CSV Types)](#group4layers-use-case-or-why-csv-types).\n\nThis library is commonly used with [FlexTable](https://github.com/Group4Layers/flextable) to facilitate the data manipulation produced by CSV Types (the data structure is consumed by FlexTable).\n\n## Installation\n\n```sh\nnpm i csv-types -S\n```\n\nOr from the repo:\n\n```sh\nnpm i \"http://github.com/Group4Layers/csv-types-js.git\"\n```\n\nIt has been tested with `node \u003e= 6`, but it is widely used in Firefox and Chrome with building tools like `webpack`.\n\n## Examples\n\nThe best way to learn something is to see how it behaves.\n\nThe configuration is set in the constructor `new CSV()` and with the method `lCSV.configure()` when the object is built. Every consequent call to `parse` will use the last options configured (it is overwritten with every `configure` call).\n\n```js\nconst CSV = require('csv-types').CSV;\nlet lCSV = new CSV(yourOptions); // configure if you need to change defaults\n// ...\nlCSV.configure(yourNewOptions); // reconfigure if you want\n```\n\nYou can just apply the defaults by doing `configure(null)` or `configure({})` (the same for the constructor).\n\nSee the available options for configure in [Options](#options).\n\n**CSV with types**\n\n```csv\n#type-a,col1,col2\ntype-a,1,2\ntype-a,2,3\n#type-b,2\ntype-b,2\n```\n\n```js\nconst CSV = require('csv-types').CSV;\nlet results = new CSV({types:true})\n    .parse(`#type-a,col1,col2\ntype-a,1,2\ntype-a,2,3\n#type-b,2\ntype-b,2`);\n```\n\n`results`:\n\n```js\n{ \"a\": { headers: [\"col1\", \"col2\"],\n         hlength: 2,\n         values: [[\"1\", \"2\"], [\"2\", \"3\"]], vlength: 2 },\n  \"b\": { headers: [\"2\"], hlength: 1, values: [[\"2\"]], vlength: 1 } }\n```\n\n**Normal CSV (no types)**\n\n```csv\n#type-a,col1,col2\ntype-a,1,2\ntype-a,2,3\n```\n\n```js\nconst CSV = require('csv-types').CSV;\nlet lCSV = new CSV();\nlet results = lCSV.parse(`#type-a,col1,col2\ntype-a,1,2\ntype-a,2,3`);\n```\n\n`results`:\n```js\n{ \"a\": { headers: [\"type-a\", \"col1\", \"col2\"],\n         hlength: 3,\n         values: [[\"type-a\", \"1\", \"2\"], [\"type-a\", \"2\", \"3\"]], vlength: 2 } }\n```\n\n**Normal csv (no types) and no header definition**\n\n```csv\n#type-a,col1,col2\ntype-a,1,2\ntype-a,2,3,4,5\n```\n\n```js\nconst CSV = require('csv-types').CSV;\nlet lCSV = new CSV({ headers: false });\nlet results = lCSV.parse(`#type-a,col1,col2\ntype-a,1,2\ntype-a,2,3,4,5`);\n```\n\n`results`:\n```js\n{ \"a\": { headers: [],\n         hlength: 0,\n         values: [[\"type-a\", \"1\", \"2\"], [\"type-a\", \"2\", \"3\", \"4\", \"5\"]],\n         vlength: 2 } }\n```\n\n**Using number casting**\n\n```csv\ncase,first,second\ntype-a,1.01,2\ntype-a,2,-3\n```\n\n```js\nconst CSV = require('csv-types').CSV;\n\nlet lCSV = new CSV();\nlCSV.configure({ cast: true, firstLineHeader: true });\nlet results = lCSV.parse(`case,first,second\ntype-a,1.01,2\ntype-a,2,-3`);\n```\n\n`results`:\n```js\n{ headers: [\"case\", \"first\", \"second\"],\n  hlength: 3,\n  values: [[\"type-a\", 1.01, 2], [\"type-a\", 2, -3]], vlength: 2 } }\n```\n\n**Using casting with types**\n\n```csv\n#type-a,1,2\ntype-a,1,2\ntype-a,2,3\n```\n\n```js\nconst CSV = require('csv-types').CSV;\n\nfunction castFn(value, isHeader, type, column){\n  let ret = value;\n  if (isHeader){\n    ret = \"the\" + value;\n  }else{\n    if (/^[\\d.]+$/.test(value)){\n      ret = Number(value);\n    }\n  }\n  return ret;\n}\n\nlet results = new CSV({types:true, cast: castFn}).parse(`#type-a,1,2\ntype-a,1,2\ntype-a,2,3`);\n```\n\n`results`:\n```js\n{ \"a\": { headers: [\"the1\", \"the2\"],\n         hlength: 2,\n         values: [[1, 2], [2, 3]], vlength: 2 } }\n```\n\n**Using casting without types**\n\n```csv\n#type-a,1,2,3\ntype-a,1,2,tres\n# comment\ntype-a,1,2,tres\n```\n\n```js\nconst CSV = require('csv-types').CSV;\n\nfunction castFn(value, isHeader, type, column, row){\n  let ret = value;\n  if (/^[\\d.]+$/.test(value)){\n    ret = Number(value);\n  }else if (type == ''){\n    ret = `r${row}c${column}`;\n  }\n  return ret;\n}\n\nlet lCSV = new CSV({ headers: false, cast: castFn });\nlet results = lCSV.parse(`#type-a,1,2,3\ntype-a,1,2,tres\n# comment\ntype-a,1,2,tres`);\n```\n\n`results`:\n```js\n{ headers: [],\n  hlength: 0,\n  values: [['r0c0', 1, 2, \"r0c3\"], ['r1c0', 1, 2, \"r1c3\"]], vlength: 2 } }\n```\n\n\n**Using row function to alter based on post-processing**\n\n```csv\n⮒\n#type-a,1,2\ntype-a,1,2\ntype-a,3,5\n#type-b,1,2,3\ntype-b,1,2,tres\n⮒\n```\n\n```js\nconst CSV = require('csv-types').CSV;\n\nfunction rowFn(array, type, definition, row){\n  if (type === 'b'){\n    return false;\n  }else{\n    let idx = definition.headers.indexOf(\"2\");\n    if (array[0] == \"1\" \u0026\u0026 array[idx] == \"2\"){\n      array[0] = \"2\";\n      array[idx] = -1;\n    }\n  }\n}\n\nlet lCSV = new CSV({row: rowFn});\nlCSV.configure({row: rowFn, types:true}); // options are overwritten\nlet results = lCSV.parse(`\n#type-a,1,2\ntype-a,1,2\ntype-a,3,5\n#type-b,1,2,3\ntype-b,1,2,tres\n`);\n```\n\n`results`:\n```js\n{ a: { headers: [ '1', '2' ],\n       hlength: 2,\n       values: [ [\"2\", -1], [\"3\", \"5\"] ], vlength: 2 },\n  b: { headers: [ '1', '2', '3' ], hlength: 3,\n       values: [], vlength: 0 } }\n```\n\n**Using row function to alter based on post-processing with no types**\n\n```csv\n⮒\n#type-a,b,c,d\ntype-a,1,2,3\ntype-a,4,0,-1\n⮒\n```\n\n```js\nfunction rowFn(array, type, definition, row){\n  let sum = 0;\n  let i = 0;\n  for (let col of array){\n    if (i \u003e 0){\n      sum += col;\n      array[i] = Number(col);\n    }\n    i++;\n  }\n  if (sum \u003e 3){\n    return false;\n  }\n}\nlet lCSV = new (require('csv-types')).CSV({ types: false, headers: false, row: rowFn });\nlet results = lCSV.parse(`\n#type-a,b,c,d\ntype-a,1,2,3\ntype-a,4,0,-1\n`);\n```\n\n`results`:\n```js\n{ headers: [], values: [[\"type-a\", 4, 0, -1]], vlength: 1 },\n```\n\n**Capturing error**\n\n```csv\n#type-a,1,2,3\ntype-a,1,2\n```\n\n```js\nconst CSV = require('csv-types').CSV;\nlet lCSV = new CSV();\nlCSV.configure({ fail: function(m){ popup.error(m); return m; } });\nlet results = CSV.parse(`\n#type-a,1,2,3\ntype-a,1,2\n`);\n```\n\nIn this case the `lCSV.parse` method would trigger `popup.error(m)` instead of `console.log(m)`.\n\n`results`:\n```js\n\"invalid row length 2 (header length 3) in line 3 col 11:\\ntype-a,1,2\\n\"\n```\n\n**Custom delimiter, escape and comment chars**\n\n```csv\n%field;num;str\n% comment\n`escaped; as you see`;243;string\n`escaped`; as you see;243\n```\n\n```js\nconst CSV = require('csv-types').CSV;\nlet lCSV = new CSV({ delimiter: ';', escape: \"`\", comment: '%' });\nlet results = lCSV.parse(`\n%field;num;str\n% comment\n\\`escaped; as you see\\`;243;string\n\\`escaped\\`; as you see;100\n`);\n```\n\n`results`:\n```js\n{ headers: [ 'field', 'num', 'str' ],\n  hlength: 3,\n  values:\n   [ [ 'escaped; as you see', '243', 'string' ],\n     [ 'escaped', 'as you see', '100' ] ],\n  vlength: 2 }\n```\n\n## Options\n\nBy default:\n\n```js\nconst opts = {\n  fail: function(m){\n    console.log(m);\n    return {\n      fail: m,\n    };\n  },\n  trim: true,\n  trimEscaped: false,\n  types: false,\n  headers: true,\n  firstLineHeader: false,\n  delimiter: ',',\n  escape: '\"',\n  comment: '#',\n  cast: false,\n  row: false,\n};\n```\n\n| option          | type      | description                                                    |\n|-----------------|-----------|----------------------------------------------------------------|\n| fail            | func      | function to fail (error is capturable)                         |\n| trim            | bool      | trim space in value (headers are always trimmed)               |\n| trimEscaped     | bool      | trim space in those escaped values (eg. \" a \" to \"a\")          |\n| types           | bool      | use types (allows multiple definitions per string)             |\n| headers         | bool      | you can omit headers when used with no types (flexible values) |\n| firstLineHeader | bool      | headers are in the first not empty line (and not commented)    |\n| delimiter       | char      | column character delimiter                                     |\n| escape          | char      | column escape character                                        |\n| comment         | char      | comment char (omits the line)                                  |\n| cast            | bool/func | cast function for every value (by default false: no casting)   |\n| row             | bool/func | row function for every row values                              |\n\nIf the cast function receives `true` it casts values that match the regexp `/^[-+]?[\\d.]+$/` to numbers. Those that do not match are not casted, so, they are considered strings.\n\nThe option `firstLineHeader` only works if `headers` is true.\n\nThe option `headers` only works if `types` is false (because types needs headers always).\n\nThe cast function receives this parameters:\n- `value` (`any`): the value (after the trimming, if applicable)\n- `isHeader` (`bool`): true if it is a header or not\n- `type` (`string`): type of the row (receives an empty string `''` if types are not used)\n- `column` (`int`): the column index starting from 0 (the first)\n- `row` (`int`): the row index starting from 0 (the first).\n\nAnd the value returned is inserted as the column value.\n\n```js\nfunction cast(value, isHeader, type, column, row){\n  // the return value is used for this column\n}\n```\n\nThe row function is not called for the headers and it receives this parameters:\n- `value` (`any[]`): array of values\n- `type` (`string`): type of the row (receives `''` if no types)\n- `definition` (`definition{}`): the global object with definitions (headers) and values so far\n- `row` (`int`): the row index starting from 0 (the first)\n\nAnd if `false` is returned, the row is not inserted in `values`.\n\n```js\nfunction row(value, type, definition, row){\n  // if false is returned, the row is omitted\n}\n```\n\nThe `definition{}` object is:\n```\n{\n  headers: any[],       // list of values\n  hlength: int,         // headers length\n  values: [any[], ...], // list of lists\n  vlength: int          // values length (rows)\n}\n```\n\n## Options for formats\n\nDepending on the CSV format different options are needed for the `CSV` constructor or the method `configure`.\n\nFormat 1: **Values**\n\n```csv\nevent,2017-01-03,sport,running,minutes,35\nevent,2017-02-05,sport,press bench,kg,85-100-104-106-106\n```\n\n```js\nlCSV.configure({ headers: false });\n```\n\nFormat 2: **Header** and **values**.\n\n```csv\ndate,activity,action,units,value\n2017-01-03,sport,running,minutes,35\n```\n\n```js\nnew CSV{ firstLineHeader: true });\n```\n\nFormat 3: Allow **comments**, **header is commented** and **values**.\n\n```csv\n#date,activity,action,units,value\n2017-01-03,sport,running,minutes,35\n# I slept just 5 hours\n2017-02-05,sport,press bench,kg,85-100-104-106-106\n```\n\nDefault options (`new CSV()`).\n\nFormat 4: **Types specs**: **comments**, **multiple commented headers** and **multiple type of values**.\n\n```csv\n#type-sport,date,activity,action,units,value\n#type-sleep,date,hours\ntype-sport,2017-01-03,sport,running,minutes,35\ntype-sleep,2017-02-05,5\ntype-sport,2017-02-05,sport,press bench,kg,85-100-104-106-106\ntype-sport,2017-02-05,sport,press bench,repetitions,12-10-10-8-7\n#type-body-condition,part,severity,description\ntype-body-condition,right shoulder,high,concentrated pain in the back part of my right shoulder\n# the gym was closed 2017-02-06, so, I work-out the next day\ntype-sport,2017-02-07,sport,pull-up,repetitions,12-12-10-10-10\n```\n\n```js\nlCSV.configure({ types: true });\n```\n\n## Group4Layers use case (or why CSV Types)\n\nWe develop the CSV types specification to allow self-contained CSV files for some applications we are developing. The advantage of CSV over other formats is that our clients (and ourselves) can modify the files without JavaScript knowledge (JSON or JavaScript objects) and with a simple text editor.\n\nOne of the applications is highly used in different areas of the company, involving benchmarking, analysis and comparisons. We have many systems/apps to be tested, and some of them create charts with data of different nature. After days of executions we ended with thousands of files, often, connected between them. With the application of CSV Types we ended writing CSV files self-contained (different format types in the same file), reducing drastically the amount of them and having a whole execution in the same file.\n\n```csv\n#type-bench,bench_ts,name,compilation_opts,use_c1,use_c2,use_c3,max_cs,devices,scheduler_num,scheduler,c1_power,c2_power,c2_power,num_packages,hguided_params,min_pkg_c1,min_pkg_c2,min_pkg_c3,k,program_args,total_time,total_ws,num_packages_launched,lws,gws,joules_cs,joules_cgs,rest\ntype-bench,1498616602,\"binomial\",\"-O2\",1,0,0,0,\"c1\",1,\"static\",1.000000,1.270000,1.000000,80,2409901,40,99,1,2,\"40960000 255\",235.331238,163840000,1,256,2621440000,45147.984375,50370.000000,\n#type-event,bench_ts,event_type,event_id,device,status,package_size,time_offset,index,value,event_info,rest\n# ...\ntype-event,1498617107,\"CB_KERNEL_END\",159,\"C1\",\"NULL\",736,66.736061,163833200,0.000000,\"\",\ntype-event,1498617107,\"CB_KERNEL_END\",160,\"C2\",\"NULL\",1584,66.736267,163831616,0.000000,\"\",\ntype-event,1498617107,\"CB_KERNEL_END\",161,\"C1\",\"NULL\",656,66.737885,163833936,0.000000,\"\",\ntype-event,1498617107,\"CB_KERNEL_END\",162,\"C3\",\"NULL\",1584,66.739273,163834592,0.000000,\"\",\ntype-event,1498617107,\"CB_KERNEL_END\",163,\"C1\",\"NULL\",640,66.739395,163836176,0.000000,\"\",\ntype-event,1498617107,\"CB_KERNEL_END\",164,\"C3\",\"NULL\",640,66.740936,163838400,0.000000,\"\",\ntype-event,1498617107,\"CB_KERNEL_END\",165,\"C2\",\"NULL\",1584,66.741219,163836816,0.000000,\"\",\ntype-event,1498617107,\"CB_KERNEL_END\",166,\"C1\",\"NULL\",640,66.742310,163839040,0.000000,\"\",\n#type-energy,bench_ts,id,time_offset,watts_cs,joules_total_cs,watts_cgs,joules_total_cgs,rest\n# ...\ntype-energy,1498616602,1,0.001046,0.000000,0.000000,107.000000,42.800000,\ntype-energy,1498616602,2,0.215948,-0.000000,11.641693,109.000000,86.400000,\ntype-energy,1498616602,3,0.415947,61.951837,24.031937,109.000000,130.000000,\ntype-energy,1498616602,4,0.615965,56.104850,35.253860,109.000000,173.600000,\ntype-energy,1498616602,5,0.815941,56.532052,46.558914,107.000000,216.400000,\ntype-energy,1498616602,6,1.016038,57.687933,58.102097,107.000000,259.200000,\ntype-energy,1498616602,7,1.215941,52.626995,68.622391,107.000000,302.000000,\n```\n\n## Test \u0026 Coverage\n\n```sh\nnpm test\nnpm run coverage\n```\n\nTests covered:\n\n```markdown\n  CSV Types Parser\n    ✓ single type\n    ✓ multiple types\n    ✓ escaped by double quotes\n    ✓ trim\n    ✓ trim escaped\n    ✓ not trim\n    ✓ not trim and trim escaped\n    ✓ open escape double quotes fail\n    ✓ open escape single quotes fail (custom escape char)\n    ✓ no header definition works (no types, no headers)\n    ✓ discard comments\n    ✓ discard comments (custom comment char)\n    ✓ use custom delimiter char (; with no headers)\n    ✓ use custom delimiter char (; with one col)\n    ✓ use custom delimiter, escape and comment chars\n    ✓ no header definition fails\n    ✓ no header definition fails (no types)\n    ✓ diff header definition fails\n    ✓ invalid header definition fails\n    ✓ all comments are ok\n    ✓ rows can start with optional spaces\n    ✓ headers are trimmed\n    ✓ headers can have no values\n    ✓ last row value is parsed when EOF\n    ✓ last header is parsed when EOF\n    ✓ repeated type header definition fails\n    ✓ single (no type)\n    ✓ invalid row length fails (no type)\n    ✓ different row lengths without headers (no type)\n    ✓ types overwrite the config headers false\n    ✓ cast with types\n    ✓ cast with types (using number caster)\n    ✓ cast with no types\n    ✓ row postprocessing with types\n    ✓ row postprocessing with no types\n    ✓ valid type row has to start with type-\n    ✓ overwrite options with defaults\n    ✓ default is with headers but not types\n    ✓ firstLineHeader is true\n    ✓ firstLineHeader only works when headers is true\n    ✓ firstLineHeader is true (with headers)\n    ✓ wrong options are discarded\n\n\n  42 passing (18ms)\n```\n\n## New features\n\nYou can request new features for this library by opening new issues. If we find it useful (or there are at least 2 users interested in a proposal) we can implement it. Also, we accept pull requests with bugfixes or new features.\n\n## Author\n\nnozalr \u003cnozalr@group4layers.com\u003e (Group4Layers®).\n\n## ChangeLog\n\n*GitHub/Gitlab readers (repo, no docs): [CHANGELOG.md](CHANGELOG.md).*\n\n## License\n\nCSV Types (csv-types-js) source code is released under the MIT License.\n\n*GitHub/Gitlab readers (repo, no docs): [LICENSE.md](LICENSE.md).*\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgroup4layers%2Fcsv-types-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgroup4layers%2Fcsv-types-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgroup4layers%2Fcsv-types-js/lists"}