New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

csv-types

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

csv-types - npm Package Compare versions

Comparing version 0.2.3 to 0.2.4

38

CHANGELOG.md
# CHANGELOG
## v0.2.4 (2017-11-02)
**News:**
- NPM package updated.
- TravisCI with lint script, removed node 4.
- Added target lint.
- Removing the build (keeping just the node stable modules version).
- Removed babel dependencies.
- Linted (clean some unused vars).
**Statistics:**
- 32 TDD Tests.
- Code coverage of 98.12%.
## v0.2.1-3 (2017-11-02)

@@ -7,5 +23,7 @@

- Creating a Github mirror
- Removing the build-es5 (keeping just the modules version and node build)
- Defaults are applied when loading the module
- Creating a Github mirror.
- Removing the build-es5 (keeping just the node stable modules version and build).
- Default options are applied when loading the module (`configure(null)` by default).
- Added .travis.yml and .eslintrc.yml.
- NPM package created.

@@ -16,4 +34,4 @@ ## v0.2.0 (2017-11-01)

- Supported CSV format 2 (header not commented, in first line)
- Added number caster (used when setting the option cast to true)
- Supported CSV format 2 (header not commented, in first line).
- Added number caster (used when setting the option cast to true).
- Improved the README with more examples and explanations.

@@ -25,4 +43,4 @@ - Added LICENSE and CHANGELOG files.

- 3 more tests regarding configuration, firstLineHeader and casters.
- 32 TDD Tests
- Code coverage of 98.14%
- 32 TDD Tests.
- Code coverage of 98.14%.

@@ -33,7 +51,7 @@ ## v0.1.0 (2017-11-01)

- Initial release (pre-publish)
- Initial release (pre-publish).
**Statistics:**
- 29 TDD Tests
- Code coverage of 98.48%
- 29 TDD Tests.
- Code coverage of 98.48%.
{
"name": "csv-types",
"version": "0.2.3",
"version": "0.2.4",
"description": "CSV Types (csv-types-js) is a JavaScript library to parse CSV (comma separated values) strings and produce a JavaScript AST (abstract syntax tree) with the data. It also supports types specs: multiple headers-values (tables) per csv string.",
"main": "dist/node/index.js",
"main": "src/index.js",
"module": "src/index.js",

@@ -10,8 +10,10 @@ "scripts": {

"test-stop": "./node_modules/mocha/bin/mocha --bail test/mocha.js",
"clean": "rm -rf dist",
"build": "npm run clean; babel --no-comments --minified src --out-dir dist/node",
"prepublishOnly": "npm run clean; npm run build",
"lint": "./node_modules/eslint/bin/eslint.js src",
"coverage": "nyc ./node_modules/mocha/bin/mocha test/mocha.js",
"coveralls": "nyc report --reporter=text-lcov | coveralls",
"coverage-html": "nyc --reporter=html ./node_modules/mocha/bin/mocha test/mocha.js"
},
"engines": {
"node": ">=6"
},
"repository": {

@@ -33,24 +35,8 @@ "type": "git",

"devDependencies": {
"babel-cli": "^6.26.0",
"babel-preset-env": "^1.6.1",
"babel-register": "^6.26.0",
"chai": "^4.1.2",
"coveralls": "^3.0.0",
"eslint": "^4.10.0",
"mocha": "^4.0.1",
"nyc": "^11.2.1"
},
"babelrc": {
"presets": [
[
"env",
{
"targets": {
"browsers": ">1%",
"node": [
"current"
]
}
}
]
]
},
"files": [

@@ -57,0 +43,0 @@ "src",

# CSV Types (csv-types-js)
[![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/rNoz/csv-types-js/blob/master/LICENSE.md) [![Coverage](https://img.shields.io/badge/coverage-98.15%25-green.svg)](https://github.com/rNoz/csv-types-js) [![Tests](https://img.shields.io/badge/tests-32%2F32-green.svg)](https://github.com/rNoz/csv-types-js)
[![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/rNoz/csv-types-js/blob/master/LICENSE.md) [![Coverage](https://img.shields.io/badge/coverage-98.12%25-green.svg)](https://github.com/rNoz/csv-types-js) [![Tests](https://img.shields.io/badge/tests-32%2F32-green.svg)](https://github.com/rNoz/csv-types-js)
CSV Types (csv-types-js) is a JavaScript library to parse CSV (comma separated values) strings and produce a JavaScript AST (abstract syntax tree) with the data. It also supports *types specs*: multiple headers-values (tables) per csv string.
It has been tested with `node >= 6`.
## Table of Contents

@@ -78,2 +80,8 @@

```sh
npm i csv-types -S
```
Or from the repo:
```sh
npm i "http://github.com/rNoz/csv-types-js.git"

@@ -80,0 +88,0 @@ ```

@@ -63,3 +63,3 @@

const casters = {
'number': function(value, isHeader){
number: function(value, isHeader){
let ret = value;

@@ -76,5 +76,2 @@ if (!isHeader){

function parse(str){
let headers = [];
let values = [];
let types = {};

@@ -111,3 +108,2 @@

let i = 0;
let p1 = 0;
let cont = true;

@@ -117,3 +113,3 @@ let state = 0;

let char = str[i];
if (lastNL){
if (lastNL) {
char = lastNL;

@@ -130,11 +126,11 @@ lastNL = false; // finish

i += 5;
lType = "";
lStr = "";
lType = '';
lStr = '';
} else if (!optTypes && !headerParsed) {
state = 1;
lType = "";
lType = '';
lTyped = true;
lArray = [];
lArrayLen = 0;
lStr = "";
lStr = '';
}else{

@@ -152,4 +148,4 @@ state = 3; // omit until EOL

i += 4;
lType = "";
lStr = "";
lType = '';
lStr = '';
}else{

@@ -160,3 +156,3 @@ return opts.fail(`invalid row value in line ${line}:\n${str.substr(lineI, i - lineI + 1)}`);

state = 2; // value
lType = "";
lType = '';
lTyped = true;

@@ -169,3 +165,3 @@ lArray = [];

state = 1;
lType = "";
lType = '';
lTyped = true;

@@ -181,3 +177,3 @@ lArray = [];

if (char === '\n' || char === ','){
if (lStr === ""){
if (lStr === ''){
return opts.fail(`invalid header '${lStr}' in line ${line} col ${i - lineI + 1}:\n${str.substr(lineI, i - lineI + 1)}`);

@@ -192,3 +188,3 @@ }else{

lTyped = true;
lStr = "";
lStr = '';
lArray = [];

@@ -239,3 +235,3 @@ lArrayLen = 0;

}else if (char === '\n'){
return opts.fail(`invalid row with open escaped double quote and reach EOL in line ${line} col ${i - lineI + 1}:\n${str.substr(lineI, i - lineI + 1)}`);
return opts.fail(`invalid row with open escaped double quote and reach EOL in line ${line} col ${i - lineI + 1}:\n${str.substr(lineI, i - lineI + 1)}`);
}

@@ -266,3 +262,3 @@ }else{

lTyped = true;
lStr = "";
lStr = '';
lArray = [];

@@ -284,3 +280,3 @@ lArrayLen = 0;

}
let insert = optRow ? optRow(lArray, lType, lDefType, lValues) != false : true;
let insert = optRow ? optRow(lArray, lType, lDefType, lValues) !== false : true;
if (insert){

@@ -338,3 +334,3 @@ lDefType.values.push(lArray);

module.exports = {
version: { major: 0, minor: 2, patch: 3 },
version: { major: 0, minor: 2, patch: 4 },
parse,

@@ -341,0 +337,0 @@ configure,

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