Header-based record columns & 'to.object' function addition #141

merged 6 commits into from Feb 10, 2014


None yet

3 participants


Commit messages should explain it all. I'm not sure if I did this right though since I'm new to git.

Joeasaurus added some commits Dec 6, 2013
@Joeasaurus Joeasaurus Added header-record based column arrangement.
You can now pass {"header":true} as an option argument to to.array(). It
will return an array of objects the same as using {"columns":[..]}
would, except it uses the header record to obtain the column names.
@Joeasaurus Joeasaurus Added to.object function.
'to.object' does the exact same thing as to.array, but puts the records
in an object{} instead of an array[]. It has a mandatory option
requirement of 'objname' which is the column/header to use to name the
records by in the resulting object.

csv: "Name,Age\nJoe,21"
objname: "Name"
output: { Joe: {Name: 'Joe', Age: '21'}
@Joeasaurus Joeasaurus Added trim() to the title names in to.object 52f2825
wdavidw commented Dec 9, 2013

I need tests and a sample. I have difficulties to understand what it's doing.


I'm not fluent with coffeescript at all, so it will take me a little while to get you some tests. I will sort out examples though :)

wdavidw commented Dec 9, 2013

feel free to do it in javascript, i really don't mind converting, otherwise it's the occasion to try


Ok all features have examples and tests now I think.


this is a very nice feature, if you let me in this case i will suggest adding a dependency to underscore and use _.object since it just has a 10 line implementation

@wdavidw wdavidw merged commit a750619 into wdavidw:master Feb 10, 2014

1 check passed

Details default The Travis CI build passed
wdavidw commented Feb 10, 2014

Why/where would do need to a this dependency? Personnaly, i'll rather import the 10 lines than referencing an external project, even underscore.

@wdavidw wdavidw added a commit that referenced this pull request Mar 14, 2014
@wdavidw Push update from #141 1811538
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment