Socket
Socket
Sign inDemoInstall

csv-writer

Package Overview
Dependencies
0
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0 to 1.0.1

31

CHANGELOG.md

@@ -0,17 +1,28 @@

# Changelog
### 1.0.0: 28 February 2018
All notable changes to this project will be documented in this file.
* Support for adding CSV records to already existing files. Thanks to @jonmelcher. [PR #4](https://github.com/ryu1kn/csv-writer/pull/4)
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
### 0.0.3: 9 November 2016
## [1.0.1] - 2018-08-09
### Fixed
- Fixed the issue that coverage report badge on README shows question mark.
Use Coveralls instead of CodeClimate to get code coverage.
* Fixed the bug that fields were not always surrounded by double quotes
* Fixed the bug that white space characters on the edge of fields were trimmed
## [1.0.0] - 2018-02-28
### Added
- Support for adding CSV records to already existing files. Thanks to @jonmelcher. [PR #4](https://github.com/ryu1kn/csv-writer/pull/4)
### 0.0.2: 15 October 2016
## [0.0.3] - 2016-11-09
### Fixed
- Fixed the bug that fields were not always surrounded by double quotes
- Fixed the bug that white space characters on the edge of fields were trimmed
* Fixed the bug that field values were not quoted when they have newline characters
## [0.0.2] - 2016-10-15
### Fixed
- Fixed the bug that field values were not quoted when they have newline characters
### 0.0.1: 9 September 2016
* Initial release of csv-writer
## [0.0.1] - 2016-09-09
### Added
- Initial release of csv-writer
{
"name": "csv-writer",
"version": "1.0.0",
"version": "1.0.1",
"description": "Convert objects/arrays into a CSV string or write them into a CSV file",
"main": "index.js",
"scripts": {
"test": "mocha test --recursive",
"coverage": "nyc mocha test --recursive",
"test": "mocha test/bootstrap.js test/lib --recursive",
"test:it": "test/integration/test.sh",
"coverage": "nyc npm test",
"lint": "eslint ."

@@ -29,2 +30,3 @@ },

"codeclimate-test-reporter": "^0.5.0",
"coveralls": "^3.0.0",
"eslint": "^4.18.1",

@@ -31,0 +33,0 @@ "eslint-config-xo": "^0.20.1",

@@ -1,2 +0,4 @@

[![Build Status](https://travis-ci.org/ryu1kn/csv-writer.svg?branch=master)](https://travis-ci.org/ryu1kn/csv-writer) [![Code Climate](https://codeclimate.com/github/ryu1kn/csv-writer/badges/gpa.svg)](https://codeclimate.com/github/ryu1kn/csv-writer) [![Test Coverage](https://codeclimate.com/github/ryu1kn/csv-writer/badges/coverage.svg)](https://codeclimate.com/github/ryu1kn/csv-writer/coverage)
[![Build Status](https://travis-ci.org/ryu1kn/csv-writer.svg?branch=master)](https://travis-ci.org/ryu1kn/csv-writer)
[![Coverage Status](https://coveralls.io/repos/github/ryu1kn/csv-writer/badge.svg?branch=master)](https://coveralls.io/github/ryu1kn/csv-writer?branch=master)
[![Code Climate](https://codeclimate.com/github/ryu1kn/csv-writer/badges/gpa.svg)](https://codeclimate.com/github/ryu1kn/csv-writer)

@@ -21,3 +23,3 @@ # CSV Writer

{id: 'name', title: 'NAME'},
{id: 'lang', title: 'LANGUAGE'},
{id: 'lang', title: 'LANGUAGE'}
]

@@ -102,3 +104,3 @@ });

{id: 'name', title: 'NAME'},
{id: 'lang', title: 'LANGUAGE'},
{id: 'lang', title: 'LANGUAGE'}
]

@@ -105,0 +107,0 @@ });

require('../index'); // Include all source files into coverage report
global.expect = require('chai').expect;
global.sinon = require('sinon');
const expect = require('chai').expect;
const ArrayCsvStringifier = require('../../../lib/csv-stringifiers/array');

@@ -3,0 +4,0 @@

const expect = require('chai').expect;
const ObjectCsvStringifier = require('../../../lib/csv-stringifiers/object');

@@ -3,0 +4,0 @@

const expect = require('chai').expect;
const sinon = require('sinon');
const CsvWriter = require('../../lib/csv-writer');

@@ -3,0 +5,0 @@

const expect = require('chai').expect;
const FieldStringifier = require('../../lib/field-stringifier');
describe('FieldStringifier', () => {
const stringifier = new FieldStringifier();
it('returns the same string', () => {
const stringifier = new FieldStringifier();
expect(stringifier.stringify('VALUE')).to.eql('VALUE');

@@ -12,3 +13,2 @@ });

it('preserves the whitespace characters', () => {
const stringifier = new FieldStringifier();
expect(stringifier.stringify(' VALUE\tA ')).to.eql(' VALUE\tA ');

@@ -18,3 +18,2 @@ });

it('wraps a field value with double quotes if the field contains comma', () => {
const stringifier = new FieldStringifier();
expect(stringifier.stringify('VALUE,A')).to.eql('"VALUE,A"');

@@ -24,3 +23,2 @@ });

it('wraps a field value with double quotes if the field contains newline', () => {
const stringifier = new FieldStringifier();
expect(stringifier.stringify('VALUE\nA')).to.eql('"VALUE\nA"');

@@ -30,3 +28,2 @@ });

it('wraps a field value with double quotes and escape the double quotes if they are used in the field', () => {
const stringifier = new FieldStringifier();
expect(stringifier.stringify('VALUE"A')).to.eql('"VALUE""A"');

@@ -36,3 +33,2 @@ });

it('escapes double quotes even if double quotes are only on the both edges of the field', () => {
const stringifier = new FieldStringifier();
expect(stringifier.stringify('"VALUE"')).to.eql('"""VALUE"""');

@@ -42,3 +38,2 @@ });

it('converts a number into a string', () => {
const stringifier = new FieldStringifier();
expect(stringifier.stringify(1)).to.eql('1');

@@ -48,3 +43,2 @@ });

it('converts undefined into an empty string', () => {
const stringifier = new FieldStringifier();
expect(stringifier.stringify()).to.eql('');

@@ -54,3 +48,2 @@ });

it('converts null into an empty string', () => {
const stringifier = new FieldStringifier();
expect(stringifier.stringify(null)).to.eql('');

@@ -60,3 +53,2 @@ });

it('converts an object into toString-ed value', () => {
const stringifier = new FieldStringifier();
const obj = {

@@ -70,3 +62,2 @@ name: 'OBJECT_NAME',

it('wraps a toString-ed field value with double quote if the value contains comma', () => {
const stringifier = new FieldStringifier();
const obj = {

@@ -80,3 +71,2 @@ name: 'OBJECT,NAME',

it('escapes double quotes in a toString-ed field value if the value has double quotes', () => {
const stringifier = new FieldStringifier();
const obj = {

@@ -83,0 +73,0 @@ name: 'OBJECT_NAME"',

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