diff --git a/nobel_winners/README.md b/nobel_winners/README.md new file mode 100644 index 0000000..e69de29 diff --git a/nobel_winners/app.js b/nobel_winners/app.js index a79c0ad..db6f7b5 100644 --- a/nobel_winners/app.js +++ b/nobel_winners/app.js @@ -1,9 +1,24 @@ +//const parse = require('csv-parse'); const fs = require('fs'); +const csvjson = require('csv-to-json'); + fs.readFile('Winners.csv', function(err, data) { - const lines = data.toString().split(/\n/); - const records = lines.map(function(line) { - // TODO: Account for data that contains commas (wrapped in quotes) - return line.split(','); - }); - console.log(records); + // const lines = data.toString().split(/\n/); + // const records = lines.map(function(line) { + // // TODO: Account for data that contains commas (wrapped in quotes) + // return line.split(','); + // }); + // console.log(data.toString()); + // const records = parse("Hello", {""}, function(records) { + // console.log(records); + // }); + //console.log(records); + + var obj = { + filename: "Winners.csv" + }; + var callback = function(err, json) { + console.log(json[0].Winner); + }; + csvjson.parse(obj, callback); }); diff --git a/nobel_winners/node_modules/csv-generate/.npmignore b/nobel_winners/node_modules/csv-generate/.npmignore new file mode 100644 index 0000000..4c9bd0a --- /dev/null +++ b/nobel_winners/node_modules/csv-generate/.npmignore @@ -0,0 +1,4 @@ +/src +/test +/Makefile +.travis.yml \ No newline at end of file diff --git a/nobel_winners/node_modules/csv-generate/LICENSE b/nobel_winners/node_modules/csv-generate/LICENSE new file mode 100644 index 0000000..f77b58e --- /dev/null +++ b/nobel_winners/node_modules/csv-generate/LICENSE @@ -0,0 +1,16 @@ +Software License Agreement (BSD License) +======================================== + +Copyright (c) 2011, SARL Adaltas. + +All rights reserved. + +Redistribution and use of this software in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +- Neither the name of SARL Adaltas nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission of the SARL Adaltas. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/nobel_winners/node_modules/csv-generate/README.md b/nobel_winners/node_modules/csv-generate/README.md new file mode 100644 index 0000000..fbb0b8f --- /dev/null +++ b/nobel_winners/node_modules/csv-generate/README.md @@ -0,0 +1,101 @@ +[![Build Status](https://secure.travis-ci.org/wdavidw/node-csv-generate.png)](http://travis-ci.org/wdavidw/node-csv-generate) + +CSV and object generation +========================= + +This package provides a flexible generator of CSV strings and Javascript objects +implementing the Node.js `stream.Readable` API. + +[Documentation for the "csv-generate" package is available here][home]. + +Features includes: + +* random or pseudo-random seed based generation +* `stream.Readable` implementation +* BSD License + +Usage +----- + +Run `npm install csv` to install the full csv module or run +`npm install csv-generate` if you are only interested by the CSV parser. + +Use the callback style API for simplicity or the stream based API for +scalability. + +### Using the callback API + +The parser receive a string and return an array inside a user-provided +callback. This example is available with the command `node samples/callback.js`. + +```javascript +var generate = require('csv-generate'); + +generate({seed: 1, columns: 2, length: 2}, function(err, output){ + output.should.eql('OMH,ONKCHhJmjadoA\nD,GeACHiN'); +}); +``` + +### Using the stream API + +```javascript +// node samples/stream.js +var generate = require('csv-generate'); + +var data = [] +var generator = generate({seed: 1, objectMode: true, columns: 2, length: 2}); +generator.on('readable', function(){ + while(d = generator.read()){ + data.push(d); + } +}); +generator.on('error', function(err){ + console.log(err); +}); +generator.on('end', function(){ + data.should.eql([ [ 'OMH', 'ONKCHhJmjadoA' ],[ 'D', 'GeACHiN' ] ]); +}); +``` + +### Using the pipe function + +One usefull function part of the Stream API is `pipe` to interact between +multiple streams. You may use this function to pipe a `stream.Readable` string +source to a `stream.Writable` object destination. The next example available as +`node samples/pipe.js` read the file, parse its content and transform it. + +```javascript +// node samples/pipe.js +var generate = require('csv-generate'); + +var generator = generate({columns: ['int', 'bool'], length: 2}); +generator.pipe(process.stdout); +``` + +Migration +--------- + +Most of the generator is imported from its parent project [CSV][csv] in a effort +to split it between the generator, the parser, the transformer and the stringifier. + +Development +----------- + +Tests are executed with mocha. To install it, simple run `npm install` +followed by `npm test`. It will install mocha and its dependencies in your +project "node_modules" directory and run the test suite. The tests run +against the CoffeeScript source files. + +To generate the JavaScript files, run `npm run coffee`. + +The test suite is run online with [Travis][travis] against the versions +0.9, 0.10 and 0.11 of Node.js. + +Contributors +------------ + +* David Worms: + +[home]: http://csv.adaltas.com/generate/ +[csv]: https://github.com/wdavidw/node-csv +[travis]: https://travis-ci.org/#!/wdavidw/node-csv-generate diff --git a/nobel_winners/node_modules/csv-generate/lib/index.js b/nobel_winners/node_modules/csv-generate/lib/index.js new file mode 100644 index 0000000..ac29b8b --- /dev/null +++ b/nobel_winners/node_modules/csv-generate/lib/index.js @@ -0,0 +1,192 @@ +// Generated by CoffeeScript 1.10.0 +var Generator, stream, util; + +stream = require('stream'); + +util = require('util'); + +module.exports = function() { + var callback, data, generator, options; + if (arguments.length === 2) { + options = arguments[0]; + callback = arguments[1]; + } else if (arguments.length === 1) { + if (typeof arguments[0] === 'function') { + options = {}; + callback = arguments[0]; + } else { + options = arguments[0]; + } + } else if (arguments.length === 0) { + options = {}; + } + generator = new Generator(options); + if (callback) { + data = []; + generator.on('readable', function() { + var d, results; + results = []; + while (d = generator.read()) { + results.push(data.push(options.objectMode ? d : d.toString())); + } + return results; + }); + generator.on('error', callback); + generator.on('end', function() { + return callback(null, options.objectMode ? data : data.join('')); + }); + } + return generator; +}; + +Generator = function(options1) { + var base, base1, base2, base3, base4, base5, base6, base7, base8, i, j, len, ref, v; + this.options = options1 != null ? options1 : {}; + stream.Readable.call(this, this.options); + this.options.count = 0; + if ((base = this.options).duration == null) { + base.duration = 4 * 60 * 1000; + } + if ((base1 = this.options).columns == null) { + base1.columns = 8; + } + if ((base2 = this.options).max_word_length == null) { + base2.max_word_length = 16; + } + if ((base3 = this.options).fixed_size == null) { + base3.fixed_size = false; + } + if (this.fixed_size_buffer == null) { + this.fixed_size_buffer = ''; + } + if ((base4 = this.options).start == null) { + base4.start = Date.now(); + } + if ((base5 = this.options).end == null) { + base5.end = null; + } + if ((base6 = this.options).seed == null) { + base6.seed = false; + } + if ((base7 = this.options).length == null) { + base7.length = -1; + } + if ((base8 = this.options).delimiter == null) { + base8.delimiter = ','; + } + this.count_written = 0; + this.count_created = 0; + if (typeof this.options.columns === 'number') { + this.options.columns = new Array(this.options.columns); + } + ref = this.options.columns; + for (i = j = 0, len = ref.length; j < len; i = ++j) { + v = ref[i]; + if (v == null) { + v = 'ascii'; + } + if (typeof v === 'string') { + this.options.columns[i] = Generator[v]; + } + } + return this; +}; + +util.inherits(Generator, stream.Readable); + +module.exports.Generator = Generator; + +Generator.prototype.random = function() { + if (this.options.seed) { + return this.options.seed = this.options.seed * Math.PI * 100 % 100 / 100; + } else { + return Math.random(); + } +}; + +Generator.prototype.end = function() { + return this.push(null); +}; + +Generator.prototype._read = function(size) { + var column, data, header, j, k, l, len, len1, len2, len3, length, line, lineLength, m, ref; + data = []; + length = this.fixed_size_buffer.length; + if (length) { + data.push(this.fixed_size_buffer); + } + while (true) { + if ((this.count_created === this.options.length) || (this.options.end && Date.now() > this.options.end)) { + if (data.length) { + if (this.options.objectMode) { + for (j = 0, len = data.length; j < len; j++) { + line = data[j]; + this.count_written++; + this.push(line); + } + } else { + this.count_written++; + this.push(data.join('')); + } + } + return this.push(null); + } + line = []; + ref = this.options.columns; + for (k = 0, len1 = ref.length; k < len1; k++) { + header = ref[k]; + line.push("" + (header(this))); + } + if (this.options.objectMode) { + lineLength = 0; + for (l = 0, len2 = line.length; l < len2; l++) { + column = line[l]; + lineLength += column.length; + } + } else { + line = "" + (this.count_created === 0 ? '' : '\n') + (line.join(this.options.delimiter)); + lineLength = line.length; + } + this.count_created++; + if (length + lineLength > size) { + if (this.options.objectMode) { + data.push(line); + for (m = 0, len3 = data.length; m < len3; m++) { + line = data[m]; + this.count_written++; + this.push(line); + } + } else { + if (this.options.fixed_size) { + this.fixed_size_buffer = line.substr(size - length); + data.push(line.substr(0, size - length)); + } else { + data.push(line); + } + this.count_written++; + this.push(data.join('')); + } + break; + } + length += lineLength; + data.push(line); + } +}; + +Generator.ascii = function(gen) { + var char, column, j, nb_chars, ref; + column = []; + for (nb_chars = j = 0, ref = Math.ceil(gen.random() * gen.options.max_word_length); 0 <= ref ? j < ref : j > ref; nb_chars = 0 <= ref ? ++j : --j) { + char = Math.floor(gen.random() * 32); + column.push(String.fromCharCode(char + (char < 16 ? 65 : 97 - 16))); + } + return column.join(''); +}; + +Generator.int = function(gen) { + return Math.floor(gen.random() * Math.pow(2, 52)); +}; + +Generator.bool = function(gen) { + return Math.floor(gen.random() * 2); +}; diff --git a/nobel_winners/node_modules/csv-generate/package.json b/nobel_winners/node_modules/csv-generate/package.json new file mode 100644 index 0000000..0bd6760 --- /dev/null +++ b/nobel_winners/node_modules/csv-generate/package.json @@ -0,0 +1,85 @@ +{ + "_args": [ + [ + { + "raw": "csv-generate@^1.0.0", + "scope": null, + "escapedName": "csv-generate", + "name": "csv-generate", + "rawSpec": "^1.0.0", + "spec": ">=1.0.0 <2.0.0", + "type": "range" + }, + "/Users/heatherdesigns/gemcityjs/collaborative-may/nobel_winners/node_modules/csv" + ] + ], + "_from": "csv-generate@>=1.0.0 <2.0.0", + "_id": "csv-generate@1.0.0", + "_inCache": true, + "_location": "/csv-generate", + "_nodeVersion": "0.12.7", + "_npmUser": { + "name": "david", + "email": "david@adaltas.com" + }, + "_npmVersion": "2.11.3", + "_phantomChildren": {}, + "_requested": { + "raw": "csv-generate@^1.0.0", + "scope": null, + "escapedName": "csv-generate", + "name": "csv-generate", + "rawSpec": "^1.0.0", + "spec": ">=1.0.0 <2.0.0", + "type": "range" + }, + "_requiredBy": [ + "/csv" + ], + "_resolved": "https://registry.npmjs.org/csv-generate/-/csv-generate-1.0.0.tgz", + "_shasum": "bd52886859d0c925f3e51f60f3abed262fa15caf", + "_shrinkwrap": null, + "_spec": "csv-generate@^1.0.0", + "_where": "/Users/heatherdesigns/gemcityjs/collaborative-may/nobel_winners/node_modules/csv", + "dependencies": {}, + "description": "CSV and object generation implementing the Node.js `stream.Readable` API", + "devDependencies": { + "coffee-script": "latest", + "mocha": "latest", + "should": "latest" + }, + "directories": {}, + "dist": { + "shasum": "bd52886859d0c925f3e51f60f3abed262fa15caf", + "tarball": "https://registry.npmjs.org/csv-generate/-/csv-generate-1.0.0.tgz" + }, + "gitHead": "152723c50b1bec71e9c00b818761fd3c2fb55202", + "homepage": "http://csv.adaltas.com/generate/", + "keywords": [ + "stream", + "generate", + "csv", + "object" + ], + "license": "BSD-3-Clause", + "main": "./lib", + "maintainers": [ + { + "name": "david", + "email": "david@adaltas.com" + } + ], + "name": "csv-generate", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "http://www.github.com/wdavidw/node-csv-generate" + }, + "scripts": { + "coffee": "coffee -b -o lib src", + "pretest": "coffee -b -o lib src", + "test": "NODE_ENV=test ./node_modules/.bin/mocha --compilers coffee:coffee-script/register --reporter dot" + }, + "version": "1.0.0" +} diff --git a/nobel_winners/node_modules/csv-generate/samples/callback.js b/nobel_winners/node_modules/csv-generate/samples/callback.js new file mode 100644 index 0000000..8ff10fe --- /dev/null +++ b/nobel_winners/node_modules/csv-generate/samples/callback.js @@ -0,0 +1,7 @@ + +should = require('should'); +generate = require('../lib'); + +generate({seed: 1, columns: 2, length: 2}, function(err, output){ + output.should.eql('OMH,ONKCHhJmjadoA\nD,GeACHiN'); +}); diff --git a/nobel_winners/node_modules/csv-generate/samples/pipe.js b/nobel_winners/node_modules/csv-generate/samples/pipe.js new file mode 100644 index 0000000..5970a91 --- /dev/null +++ b/nobel_winners/node_modules/csv-generate/samples/pipe.js @@ -0,0 +1,6 @@ + +should = require('should'); +generate = require('../lib'); + +var generator = generate({columns: ['int', 'bool'], length: 2}); +generator.pipe(process.stdout); diff --git a/nobel_winners/node_modules/csv-generate/samples/stream.js b/nobel_winners/node_modules/csv-generate/samples/stream.js new file mode 100644 index 0000000..3a7cf40 --- /dev/null +++ b/nobel_winners/node_modules/csv-generate/samples/stream.js @@ -0,0 +1,17 @@ + +should = require('should'); +generate = require('../lib'); + +var data = [] +var generator = generate({seed: 1, objectMode: true, columns: 2, length: 2}); +generator.on('readable', function(){ + while(d = generator.read()){ + data.push(d); + } +}); +generator.on('error', function(err){ + console.log(err); +}); +generator.on('end', function(){ + data.should.eql([ [ 'OMH', 'ONKCHhJmjadoA' ],[ 'D', 'GeACHiN' ] ]); +}); diff --git a/nobel_winners/node_modules/csv-parse/.npmignore b/nobel_winners/node_modules/csv-parse/.npmignore new file mode 100644 index 0000000..4c9bd0a --- /dev/null +++ b/nobel_winners/node_modules/csv-parse/.npmignore @@ -0,0 +1,4 @@ +/src +/test +/Makefile +.travis.yml \ No newline at end of file diff --git a/nobel_winners/node_modules/csv-parse/LICENSE b/nobel_winners/node_modules/csv-parse/LICENSE new file mode 100644 index 0000000..f77b58e --- /dev/null +++ b/nobel_winners/node_modules/csv-parse/LICENSE @@ -0,0 +1,16 @@ +Software License Agreement (BSD License) +======================================== + +Copyright (c) 2011, SARL Adaltas. + +All rights reserved. + +Redistribution and use of this software in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +- Neither the name of SARL Adaltas nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission of the SARL Adaltas. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/nobel_winners/node_modules/csv-parse/README.md b/nobel_winners/node_modules/csv-parse/README.md new file mode 100644 index 0000000..1fa5ee0 --- /dev/null +++ b/nobel_winners/node_modules/csv-parse/README.md @@ -0,0 +1,28 @@ +[![Build Status](https://secure.travis-ci.org/wdavidw/node-csv-parse.png)][travis] + +Part of the [CSV module][csv_home], this project is a parser converting CSV text +input into arrays or objects. It implements the Node.js +[`stream.Transform` API][stream_transform]. It also provides a simple +callback-based API for convenience. It is both extremely easy to use and +powerful. It was first released in 2010 and is used against big data sets by a +large community. + +[Documentation for the "csv-parse" package is available here][home]. + +## Features + +* Follow the Node.js streaming API +* Simplicity with the optional callback API +* Support delimiters, quotes, escape characters and comments +* Line breaks discovery +* Support big datasets +* Complete test coverage and samples for inspiration +* no external dependencies +* to be used conjointly with `csv-generate`, `stream-transform` and `csv-stringify` +* BSD License + +[home]: http://csv.adaltas.com/parse/ +[csv_home]: https://github.com/wdavidw/node-csv +[stream_transform]: http://nodejs.org/api/stream.html#stream_class_stream_transform +[travis]: http://travis-ci.org/wdavidw/node-csv-parse + diff --git a/nobel_winners/node_modules/csv-parse/lib/index.js b/nobel_winners/node_modules/csv-parse/lib/index.js new file mode 100644 index 0000000..9775c4e --- /dev/null +++ b/nobel_winners/node_modules/csv-parse/lib/index.js @@ -0,0 +1,510 @@ +// Generated by CoffeeScript 1.10.0 +var Parser, StringDecoder, stream, util; + +stream = require('stream'); + +util = require('util'); + +StringDecoder = require('string_decoder').StringDecoder; + +module.exports = function() { + var callback, called, chunks, data, options, parser; + if (arguments.length === 3) { + data = arguments[0]; + options = arguments[1]; + callback = arguments[2]; + if (typeof callback !== 'function') { + throw Error("Invalid callback argument: " + (JSON.stringify(callback))); + } + if (!(typeof data === 'string' || Buffer.isBuffer(arguments[0]))) { + return callback(Error("Invalid data argument: " + (JSON.stringify(data)))); + } + } else if (arguments.length === 2) { + if (typeof arguments[0] === 'string' || Buffer.isBuffer(arguments[0])) { + data = arguments[0]; + } else { + options = arguments[0]; + } + if (typeof arguments[1] === 'function') { + callback = arguments[1]; + } else { + options = arguments[1]; + } + } else if (arguments.length === 1) { + if (typeof arguments[0] === 'function') { + callback = arguments[0]; + } else { + options = arguments[0]; + } + } + if (options == null) { + options = {}; + } + parser = new Parser(options); + if (data != null) { + process.nextTick(function() { + parser.write(data); + return parser.end(); + }); + } + if (callback) { + called = false; + chunks = options.objname ? {} : []; + parser.on('readable', function() { + var chunk, results; + results = []; + while (chunk = parser.read()) { + if (options.objname) { + results.push(chunks[chunk[0]] = chunk[1]); + } else { + results.push(chunks.push(chunk)); + } + } + return results; + }); + parser.on('error', function(err) { + called = true; + return callback(err); + }); + parser.on('end', function() { + if (!called) { + return callback(null, chunks); + } + }); + } + return parser; +}; + +Parser = function(options) { + var base, base1, base10, base11, base12, base13, base14, base15, base16, base2, base3, base4, base5, base6, base7, base8, base9, k, v; + if (options == null) { + options = {}; + } + options.objectMode = true; + this.options = {}; + for (k in options) { + v = options[k]; + this.options[k] = v; + } + stream.Transform.call(this, this.options); + if ((base = this.options).rowDelimiter == null) { + base.rowDelimiter = null; + } + if (typeof this.options.rowDelimiter === 'string') { + this.options.rowDelimiter = [this.options.rowDelimiter]; + } + if ((base1 = this.options).delimiter == null) { + base1.delimiter = ','; + } + if ((base2 = this.options).quote == null) { + base2.quote = '"'; + } + if ((base3 = this.options).escape == null) { + base3.escape = '"'; + } + if ((base4 = this.options).columns == null) { + base4.columns = null; + } + if ((base5 = this.options).comment == null) { + base5.comment = ''; + } + if ((base6 = this.options).objname == null) { + base6.objname = false; + } + if ((base7 = this.options).trim == null) { + base7.trim = false; + } + if ((base8 = this.options).ltrim == null) { + base8.ltrim = false; + } + if ((base9 = this.options).rtrim == null) { + base9.rtrim = false; + } + if ((base10 = this.options).auto_parse == null) { + base10.auto_parse = false; + } + if ((base11 = this.options).auto_parse_date == null) { + base11.auto_parse_date = false; + } + if ((base12 = this.options).relax == null) { + base12.relax = false; + } + if ((base13 = this.options).relax_column_count == null) { + base13.relax_column_count = false; + } + if ((base14 = this.options).skip_empty_lines == null) { + base14.skip_empty_lines = false; + } + if ((base15 = this.options).max_limit_on_data_read == null) { + base15.max_limit_on_data_read = 128000; + } + if ((base16 = this.options).skip_lines_with_empty_values == null) { + base16.skip_lines_with_empty_values = false; + } + this.lines = 0; + this.count = 0; + this.skipped_line_count = 0; + this.empty_line_count = 0; + this.is_int = /^(\-|\+)?([1-9]+[0-9]*)$/; + this.is_float = function(value) { + return (value - parseFloat(value) + 1) >= 0; + }; + this._ = {}; + this._.decoder = new StringDecoder(); + this._.quoting = false; + this._.commenting = false; + this._.field = null; + this._.nextChar = null; + this._.closingQuote = 0; + this._.line = []; + this._.chunks = []; + this._.rawBuf = ''; + this._.buf = ''; + if (this.options.rowDelimiter) { + this._.rowDelimiterLength = Math.max.apply(Math, this.options.rowDelimiter.map(function(v) { + return v.length; + })); + } + return this; +}; + +util.inherits(Parser, stream.Transform); + +module.exports.Parser = Parser; + +Parser.prototype._transform = function(chunk, encoding, callback) { + var err, error; + if (chunk instanceof Buffer) { + chunk = this._.decoder.write(chunk); + } + try { + this.__write(chunk, false); + return callback(); + } catch (error) { + err = error; + return this.emit('error', err); + } +}; + +Parser.prototype._flush = function(callback) { + var err, error; + try { + this.__write(this._.decoder.end(), true); + if (this._.quoting) { + this.emit('error', new Error("Quoted field not terminated at line " + (this.lines + 1))); + return; + } + if (this._.line.length > 0) { + this.__push(this._.line); + } + return callback(); + } catch (error) { + err = error; + return this.emit('error', err); + } +}; + +Parser.prototype.__push = function(line) { + var field, i, j, len, lineAsColumns, rawBuf, row; + if (this.options.skip_lines_with_empty_values && line.join('').trim() === '') { + return; + } + row = null; + if (this.options.columns === true) { + this.options.columns = line; + rawBuf = ''; + return; + } else if (typeof this.options.columns === 'function') { + this.options.columns = this.options.columns(line); + rawBuf = ''; + return; + } + if (!this._.line_length && line.length > 0) { + this._.line_length = this.options.columns ? this.options.columns.length : line.length; + } + if (line.length === 1 && line[0] === '') { + this.empty_line_count++; + } else if (line.length !== this._.line_length) { + if (this.options.relax_column_count) { + this.skipped_line_count++; + } else if (this.options.columns != null) { + throw Error("Number of columns on line " + this.lines + " does not match header"); + } else { + throw Error("Number of columns is inconsistent on line " + this.lines); + } + } else { + this.count++; + } + if (this.options.columns != null) { + lineAsColumns = {}; + for (i = j = 0, len = line.length; j < len; i = ++j) { + field = line[i]; + if (this.options.columns[i] === false) { + continue; + } + lineAsColumns[this.options.columns[i]] = field; + } + if (this.options.objname) { + row = [lineAsColumns[this.options.objname], lineAsColumns]; + } else { + row = lineAsColumns; + } + } else { + row = line; + } + if (this.count < this.options.from) { + return; + } + if (this.count > this.options.to) { + return; + } + if (this.options.raw) { + this.push({ + raw: this._.rawBuf, + row: row + }); + return this._.rawBuf = ''; + } else { + return this.push(row); + } +}; + +Parser.prototype.__write = function(chars, end) { + var areNextCharsDelimiter, areNextCharsRowDelimiters, auto_parse, char, escapeIsQuote, i, isDelimiter, isEscape, isNextCharAComment, isQuote, isRowDelimiter, isRowDelimiterLength, is_float, is_int, l, ltrim, nextCharPos, ref, ref1, ref2, ref3, ref4, remainingBuffer, results, rowDelimiter, rtrim, wasCommenting; + is_int = (function(_this) { + return function(value) { + if (typeof _this.is_int === 'function') { + return _this.is_int(value); + } else { + return _this.is_int.test(value); + } + }; + })(this); + is_float = (function(_this) { + return function(value) { + if (typeof _this.is_float === 'function') { + return _this.is_float(value); + } else { + return _this.is_float.test(value); + } + }; + })(this); + auto_parse = (function(_this) { + return function(value) { + var m; + if (!_this.options.auto_parse) { + return value; + } + if (is_int(value)) { + value = parseInt(value); + } else if (is_float(value)) { + value = parseFloat(value); + } else if (_this.options.auto_parse_date) { + m = Date.parse(value); + if (!isNaN(m)) { + value = new Date(m); + } + } + return value; + }; + })(this); + ltrim = this.options.trim || this.options.ltrim; + rtrim = this.options.trim || this.options.rtrim; + chars = this._.buf + chars; + l = chars.length; + i = 0; + if (this.lines === 0 && 0xFEFF === chars.charCodeAt(0)) { + i++; + } + while (i < l) { + if (!end) { + remainingBuffer = chars.substr(i, l - i); + if ((!this.options.rowDelimiter && i + 3 > l) || (!this._.commenting && l - i < this.options.comment.length && this.options.comment.substr(0, l - i) === remainingBuffer) || (this.options.rowDelimiter && l - i < this._.rowDelimiterLength && this.options.rowDelimiter.some(function(rd) { + return rd.substr(0, l - i) === remainingBuffer; + })) || (this.options.rowDelimiter && this._.quoting && l - i < (this.options.quote.length + this._.rowDelimiterLength) && this.options.rowDelimiter.some((function(_this) { + return function(rd) { + return (_this.options.quote + rd).substr(0, l - i) === remainingBuffer; + }; + })(this))) || (l - i <= this.options.delimiter.length && this.options.delimiter.substr(0, l - i) === remainingBuffer) || (l - i <= this.options.escape.length && this.options.escape.substr(0, l - i) === remainingBuffer)) { + break; + } + } + char = this._.nextChar ? this._.nextChar : chars.charAt(i); + this._.nextChar = l > i + 1 ? chars.charAt(i + 1) : ''; + if (this.options.raw) { + this._.rawBuf += char; + } + if (this.options.rowDelimiter == null) { + nextCharPos = i; + rowDelimiter = null; + if (!this._.quoting && (char === '\n' || char === '\r')) { + rowDelimiter = char; + nextCharPos += 1; + } else if (!(!this._.quoting && char === this.options.quote) && (this._.nextChar === '\n' || this._.nextChar === '\r')) { + rowDelimiter = this._.nextChar; + nextCharPos += 2; + if (this.raw) { + rawBuf += this._.nextChar; + } + } + if (rowDelimiter) { + if (rowDelimiter === '\r' && chars.charAt(nextCharPos) === '\n') { + rowDelimiter += '\n'; + } + this.options.rowDelimiter = [rowDelimiter]; + this._.rowDelimiterLength = rowDelimiter.length; + } + } + if (!this._.commenting && char === this.options.escape) { + escapeIsQuote = this.options.escape === this.options.quote; + isEscape = this._.nextChar === this.options.escape; + isQuote = this._.nextChar === this.options.quote; + if (!(escapeIsQuote && (this._.field == null) && !this._.quoting) && (isEscape || isQuote)) { + i++; + char = this._.nextChar; + this._.nextChar = chars.charAt(i + 1); + if (this._.field == null) { + this._.field = ''; + } + this._.field += char; + if (this.options.raw) { + this._.rawBuf += char; + } + i++; + continue; + } + } + if (!this._.commenting && char === this.options.quote) { + if (this._.quoting) { + areNextCharsRowDelimiters = this.options.rowDelimiter && this.options.rowDelimiter.some(function(rd) { + return chars.substr(i + 1, rd.length) === rd; + }); + areNextCharsDelimiter = chars.substr(i + 1, this.options.delimiter.length) === this.options.delimiter; + isNextCharAComment = this._.nextChar === this.options.comment; + if (this._.nextChar && !areNextCharsRowDelimiters && !areNextCharsDelimiter && !isNextCharAComment) { + if (this.options.relax) { + this._.quoting = false; + this._.field = "" + this.options.quote + this._.field; + } else { + throw Error("Invalid closing quote at line " + (this.lines + 1) + "; found " + (JSON.stringify(this._.nextChar)) + " instead of delimiter " + (JSON.stringify(this.options.delimiter))); + } + } else { + this._.quoting = false; + this._.closingQuote = this.options.quote.length; + i++; + if (end && i === l) { + this._.line.push(auto_parse(this._.field || '')); + this._.field = null; + } + continue; + } + } else if (!this._.field) { + this._.quoting = true; + i++; + continue; + } else if ((this._.field != null) && !this.options.relax) { + throw Error("Invalid opening quote at line " + (this.lines + 1)); + } + } + isRowDelimiter = this.options.rowDelimiter && this.options.rowDelimiter.some(function(rd) { + return chars.substr(i, rd.length) === rd; + }); + if (isRowDelimiter) { + isRowDelimiterLength = this.options.rowDelimiter.filter(function(rd) { + return chars.substr(i, rd.length) === rd; + })[0].length; + } + if (isRowDelimiter || (end && i === l - 1)) { + this.lines++; + } + wasCommenting = false; + if (!this._.commenting && !this._.quoting && this.options.comment && chars.substr(i, this.options.comment.length) === this.options.comment) { + this._.commenting = true; + } else if (this._.commenting && isRowDelimiter) { + wasCommenting = true; + this._.commenting = false; + } + isDelimiter = chars.substr(i, this.options.delimiter.length) === this.options.delimiter; + if (!this._.commenting && !this._.quoting && (isDelimiter || isRowDelimiter)) { + if (isRowDelimiter && this._.line.length === 0 && (this._.field == null)) { + if (wasCommenting || this.options.skip_empty_lines) { + i += isRowDelimiterLength; + this._.nextChar = chars.charAt(i); + continue; + } + } + if (rtrim) { + if (!this._.closingQuote) { + this._.field = (ref = this._.field) != null ? ref.trimRight() : void 0; + } + } + this._.line.push(auto_parse(this._.field || '')); + this._.closingQuote = 0; + this._.field = null; + if (isDelimiter) { + i += this.options.delimiter.length; + this._.nextChar = chars.charAt(i); + if (end && !this._.nextChar) { + isRowDelimiter = true; + this._.line.push(''); + } + } + if (isRowDelimiter) { + this.__push(this._.line); + this._.line = []; + i += isRowDelimiterLength; + this._.nextChar = chars.charAt(i); + continue; + } + } else if (!this._.commenting && !this._.quoting && (char === ' ' || char === '\t')) { + if (this._.field == null) { + this._.field = ''; + } + if (!(ltrim && !this._.field)) { + this._.field += char; + } + i++; + } else if (!this._.commenting) { + if (this._.field == null) { + this._.field = ''; + } + this._.field += char; + i++; + } else { + i++; + } + if (!this._.commenting && ((ref1 = this._.field) != null ? ref1.length : void 0) > this.options.max_limit_on_data_read) { + throw Error("Delimiter not found in the file " + (JSON.stringify(this.options.delimiter))); + } + if (!this._.commenting && ((ref2 = this._.line) != null ? ref2.length : void 0) > this.options.max_limit_on_data_read) { + throw Error("Row delimiter not found in the file " + (JSON.stringify(this.options.rowDelimiter))); + } + } + if (end) { + if (this._.field != null) { + if (rtrim) { + if (!this._.closingQuote) { + this._.field = (ref3 = this._.field) != null ? ref3.trimRight() : void 0; + } + } + this._.line.push(auto_parse(this._.field || '')); + this._.field = null; + } + if (((ref4 = this._.field) != null ? ref4.length : void 0) > this.options.max_limit_on_data_read) { + throw Error("Delimiter not found in the file " + (JSON.stringify(this.options.delimiter))); + } + if (l === 0) { + this.lines++; + } + if (this._.line.length > this.options.max_limit_on_data_read) { + throw Error("Row delimiter not found in the file " + (JSON.stringify(this.options.rowDelimiter))); + } + } + this._.buf = ''; + results = []; + while (i < l) { + this._.buf += chars.charAt(i); + results.push(i++); + } + return results; +}; diff --git a/nobel_winners/node_modules/csv-parse/lib/sync.js b/nobel_winners/node_modules/csv-parse/lib/sync.js new file mode 100644 index 0000000..7362c9c --- /dev/null +++ b/nobel_winners/node_modules/csv-parse/lib/sync.js @@ -0,0 +1,32 @@ +// Generated by CoffeeScript 1.10.0 +var StringDecoder, parse; + +StringDecoder = require('string_decoder').StringDecoder; + +parse = require('./index'); + +module.exports = function(data, options) { + var decoder, parser, records; + if (options == null) { + options = {}; + } + records = options.objname ? {} : []; + if (data instanceof Buffer) { + decoder = new StringDecoder(); + data = decoder.write(data); + } + parser = new parse.Parser(options); + parser.push = function(record) { + if (options.objname) { + return records[record[0]] = record[1]; + } else { + return records.push(record); + } + }; + parser.__write(data, false); + if (data instanceof Buffer) { + parser.__write(data.end(), true); + } + parser._flush((function() {})); + return records; +}; diff --git a/nobel_winners/node_modules/csv-parse/package.json b/nobel_winners/node_modules/csv-parse/package.json new file mode 100644 index 0000000..bb99c88 --- /dev/null +++ b/nobel_winners/node_modules/csv-parse/package.json @@ -0,0 +1,160 @@ +{ + "_args": [ + [ + { + "raw": "csv-parse", + "scope": null, + "escapedName": "csv-parse", + "name": "csv-parse", + "rawSpec": "", + "spec": "latest", + "type": "tag" + }, + "/Users/heatherdesigns/gemcityjs/collaborative-may/nobel_winners" + ] + ], + "_from": "csv-parse@latest", + "_id": "csv-parse@1.2.0", + "_inCache": true, + "_location": "/csv-parse", + "_nodeVersion": "6.7.0", + "_npmOperationalInternal": { + "host": "packages-18-east.internal.npmjs.com", + "tmp": "tmp/csv-parse-1.2.0.tgz_1485443251887_0.9736066460609436" + }, + "_npmUser": { + "name": "david", + "email": "david@adaltas.com" + }, + "_npmVersion": "3.10.3", + "_phantomChildren": {}, + "_requested": { + "raw": "csv-parse", + "scope": null, + "escapedName": "csv-parse", + "name": "csv-parse", + "rawSpec": "", + "spec": "latest", + "type": "tag" + }, + "_requiredBy": [ + "#USER", + "/", + "/csv" + ], + "_resolved": "https://registry.npmjs.org/csv-parse/-/csv-parse-1.2.0.tgz", + "_shasum": "047b73868ab9a85746e885f637f9ed0fb645a425", + "_shrinkwrap": null, + "_spec": "csv-parse", + "_where": "/Users/heatherdesigns/gemcityjs/collaborative-may/nobel_winners", + "contributors": [ + { + "name": "David Worms", + "email": "david@adaltas.com", + "url": "http://www.adaltas.com" + }, + { + "name": "Will White", + "url": "https://github.com/willwhite" + }, + { + "name": "Justin Latimer", + "url": "https://github.com/justinlatimer" + }, + { + "name": "jonseymour", + "url": "https://github.com/jonseymour" + }, + { + "name": "pascalopitz", + "url": "https://github.com/pascalopitz" + }, + { + "name": "Josh Pschorr", + "url": "https://github.com/jpschorr" + }, + { + "name": "Elad Ben-Israel", + "url": "https://github.com/eladb" + }, + { + "name": "Philippe Plantier", + "url": "https://github.com/phipla" + }, + { + "name": "Tim Oxley", + "url": "https://github.com/timoxley" + }, + { + "name": "Damon Oehlman", + "url": "https://github.com/DamonOehlman" + }, + { + "name": "Alexandru Topliceanu", + "url": "https://github.com/topliceanu" + }, + { + "name": "Visup", + "url": "https://github.com/visup" + }, + { + "name": "Edmund von der Burg", + "url": "https://github.com/evdb" + }, + { + "name": "Douglas Christopher Wilson", + "url": "https://github.com/dougwilson" + }, + { + "name": "Joe Eaves", + "url": "https://github.com/Joeasaurus" + }, + { + "name": "Mark Stosberg", + "url": "https://github.com/markstos" + } + ], + "dependencies": {}, + "description": "CSV parsing implementing the Node.js `stream.Transform` API", + "devDependencies": { + "coffee-script": "1.10.0", + "csv-generate": "1.0.0", + "csv-spectrum": "1.0.0", + "each": "0.6.1", + "mocha": "2.5.3", + "should": "9.0.2" + }, + "directories": {}, + "dist": { + "shasum": "047b73868ab9a85746e885f637f9ed0fb645a425", + "tarball": "https://registry.npmjs.org/csv-parse/-/csv-parse-1.2.0.tgz" + }, + "gitHead": "2ec704e757000eb0ecb17dc231a9a669b66c702e", + "homepage": "http://csv.adaltas.com/parse/", + "keywords": [ + "csv", + "parse", + "parser" + ], + "license": "BSD-3-Clause", + "main": "./lib", + "maintainers": [ + { + "name": "david", + "email": "david@adaltas.com" + } + ], + "name": "csv-parse", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "http://www.github.com/wdavidw/node-csv-parse" + }, + "scripts": { + "coffee": "coffee -b -o lib src", + "pretest": "coffee -b -o lib src", + "test": "NODE_ENV=test ./node_modules/.bin/mocha --compilers coffee:coffee-script/register --reporter dot" + }, + "version": "1.2.0" +} diff --git a/nobel_winners/node_modules/csv-parse/samples/callback.js b/nobel_winners/node_modules/csv-parse/samples/callback.js new file mode 100644 index 0000000..0ef07a1 --- /dev/null +++ b/nobel_winners/node_modules/csv-parse/samples/callback.js @@ -0,0 +1,11 @@ + +// The package "should" must be installed: +// `npm install should` + +var parse = require('../lib'); +require('should'); + +var input = '#Welcome\n"1","2","3","4"\n"a","b","c","d"'; +parse(input, {comment: '#'}, function(err, output){ + output.should.eql([ [ '1', '2', '3', '4' ], [ 'a', 'b', 'c', 'd' ] ]); +}); diff --git a/nobel_winners/node_modules/csv-parse/samples/columns-discovery.in b/nobel_winners/node_modules/csv-parse/samples/columns-discovery.in new file mode 100644 index 0000000..8b15e7c --- /dev/null +++ b/nobel_winners/node_modules/csv-parse/samples/columns-discovery.in @@ -0,0 +1,3 @@ +Foo,Bar,Baz +first,row,items +second,row,items \ No newline at end of file diff --git a/nobel_winners/node_modules/csv-parse/samples/columns-discovery.js b/nobel_winners/node_modules/csv-parse/samples/columns-discovery.js new file mode 100644 index 0000000..6cd5473 --- /dev/null +++ b/nobel_winners/node_modules/csv-parse/samples/columns-discovery.js @@ -0,0 +1,22 @@ + +// The package "should" must be installed: +// `npm install should` + +fs = require('fs'); +parse = require('..'); + +// Using the first line of the CSV data to discover the column names +rs = fs.createReadStream(__dirname+'/columns-discovery.in'); +parser = parse({columns: true}, function(err, data){ + console.log(data); +}) +rs.pipe(parser); + +/* + +`node samples/header-based-columns.js` + +[ { Foo: 'first', Bar: 'row', Baz: 'items' }, + { Foo: 'second', Bar: 'row', Baz: 'items' } ] + +*/ \ No newline at end of file diff --git a/nobel_winners/node_modules/csv-parse/samples/comment.js b/nobel_winners/node_modules/csv-parse/samples/comment.js new file mode 100644 index 0000000..33512f2 --- /dev/null +++ b/nobel_winners/node_modules/csv-parse/samples/comment.js @@ -0,0 +1,15 @@ + +// The package "should" must be installed: +// `npm install should` + +var parse = require('..'); +should = require('should') + +parse( + '#Welcome\n"1","2","3","4"\n"a","b","c","d"', + {comment: '#'}, + function(err, data){ + data.should.eql([ [ '1', '2', '3', '4' ], [ 'a', 'b', 'c', 'd' ] ]); + } +); + diff --git a/nobel_winners/node_modules/csv-parse/samples/fs_read.csv b/nobel_winners/node_modules/csv-parse/samples/fs_read.csv new file mode 100644 index 0000000..6e627cd --- /dev/null +++ b/nobel_winners/node_modules/csv-parse/samples/fs_read.csv @@ -0,0 +1,3 @@ +abc;123 +def;456 +ghi;789 diff --git a/nobel_winners/node_modules/csv-parse/samples/fs_read.js b/nobel_winners/node_modules/csv-parse/samples/fs_read.js new file mode 100644 index 0000000..164b195 --- /dev/null +++ b/nobel_winners/node_modules/csv-parse/samples/fs_read.js @@ -0,0 +1,9 @@ + +var fs = require('fs'); +var parse = require('..'); + +var parser = parse({delimiter: ';'}, function(err, data){ + console.log(data); +}); + +fs.createReadStream(__dirname+'/fs_read.csv').pipe(parser); diff --git a/nobel_winners/node_modules/csv-parse/samples/objname.js b/nobel_winners/node_modules/csv-parse/samples/objname.js new file mode 100644 index 0000000..117ad8f --- /dev/null +++ b/nobel_winners/node_modules/csv-parse/samples/objname.js @@ -0,0 +1,18 @@ + +// The package "should" must be installed: +// `npm install should` + +var parse = require('..'); +require('should'); + +parse( + 'ColumnOne,ColumnTwo\nfirst,Data\nsecond,MoreData', + {'columns':true, 'objname': "ColumnOne"}, + function(err, data){ + if(err) throw err; + data.should.eql({ + first: { ColumnOne: 'first', ColumnTwo: 'Data' }, + second: { ColumnOne: 'second', ColumnTwo: 'MoreData' } + }); + } +); diff --git a/nobel_winners/node_modules/csv-parse/samples/pipe.js b/nobel_winners/node_modules/csv-parse/samples/pipe.js new file mode 100644 index 0000000..345b1a9 --- /dev/null +++ b/nobel_winners/node_modules/csv-parse/samples/pipe.js @@ -0,0 +1,17 @@ + +// The package "stream-transform" must be installed: +// `npm install stream-transform` + +var fs = require('fs'); +var parse = require('..'); +var transform = require('stream-transform'); + +var parser = parse({delimiter: ':'}) +var input = fs.createReadStream('/etc/passwd'); +var transformer = transform(function(record, callback){ + setTimeout(function(){ + callback(null, record.join(' ')+'\n'); + }, 500); +}, {parallel: 10}); +input.pipe(parser).pipe(transformer).pipe(process.stdout); + diff --git a/nobel_winners/node_modules/csv-parse/samples/stream.js b/nobel_winners/node_modules/csv-parse/samples/stream.js new file mode 100644 index 0000000..498027a --- /dev/null +++ b/nobel_winners/node_modules/csv-parse/samples/stream.js @@ -0,0 +1,34 @@ + +// The package "should" must be installed: +// `npm install should` + +var parse = require('../lib'); +require('should'); + +var output = []; +// Create the parser +var parser = parse({delimiter: ':'}); +// Use the writable stream api +parser.on('readable', function(){ + var record; + while (record = parser.read()) { + output.push(record); + } +}); +// Catch any error +parser.on('error', function(err){ + console.log(err.message); +}); +// When we are done, test that the parsed output matched what expected +parser.on('finish', function(){ + output.should.eql([ + [ 'root','x','0','0','root','/root','/bin/bash' ], + [ 'someone','x','1022','1022','a funny cat','/home/someone','/bin/bash' ] + ]); +}); +// Now that setup is done, write data to the stream +parser.write("root:x:0:0:root:/root:/bin/bash\n"); +parser.write("someone:x:1022:1022:a funny cat:/home/someone:/bin/bash\n"); +// Close the readable stream +parser.end(); + diff --git a/nobel_winners/node_modules/csv-parse/samples/sync.js b/nobel_winners/node_modules/csv-parse/samples/sync.js new file mode 100644 index 0000000..4de6405 --- /dev/null +++ b/nobel_winners/node_modules/csv-parse/samples/sync.js @@ -0,0 +1,10 @@ + +// The package "should" must be installed: +// `npm install should` + +var parse = require('../lib/sync'); +require('should'); + +var input = '"key_1","key_2"\n"value 1","value 2"'; +var records = parse(input, {columns: true}); +records.should.eql([{ key_1: 'value 1', key_2: 'value 2' }]); diff --git a/nobel_winners/node_modules/csv-parse/samples/tsv.js b/nobel_winners/node_modules/csv-parse/samples/tsv.js new file mode 100644 index 0000000..b8526ec --- /dev/null +++ b/nobel_winners/node_modules/csv-parse/samples/tsv.js @@ -0,0 +1,11 @@ + +// The package "should" must be installed: +// `npm install should` + +parse = require('..'); +should = require('should'); + +parse( "1 2 3\ra b c", {delimiter: '\t'}, function(err, data){ + if(err) throw err; + data.should.eql([ [ '1', '2', '3' ], [ 'a', 'b', 'c' ] ]); +}); diff --git a/nobel_winners/node_modules/csv-parse/test.coffee b/nobel_winners/node_modules/csv-parse/test.coffee new file mode 100644 index 0000000..a0d9236 --- /dev/null +++ b/nobel_winners/node_modules/csv-parse/test.coffee @@ -0,0 +1,4 @@ + +parse = require './src' +parser = parse 'address,name,"\n"\r\nsf,test,', (err, data) -> + console.log err, data diff --git a/nobel_winners/node_modules/csv-stringify/.npmignore b/nobel_winners/node_modules/csv-stringify/.npmignore new file mode 100644 index 0000000..4c9bd0a --- /dev/null +++ b/nobel_winners/node_modules/csv-stringify/.npmignore @@ -0,0 +1,4 @@ +/src +/test +/Makefile +.travis.yml \ No newline at end of file diff --git a/nobel_winners/node_modules/csv-stringify/LICENSE b/nobel_winners/node_modules/csv-stringify/LICENSE new file mode 100644 index 0000000..f77b58e --- /dev/null +++ b/nobel_winners/node_modules/csv-stringify/LICENSE @@ -0,0 +1,16 @@ +Software License Agreement (BSD License) +======================================== + +Copyright (c) 2011, SARL Adaltas. + +All rights reserved. + +Redistribution and use of this software in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +- Neither the name of SARL Adaltas nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission of the SARL Adaltas. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/nobel_winners/node_modules/csv-stringify/README.md b/nobel_winners/node_modules/csv-stringify/README.md new file mode 100644 index 0000000..86ef7b7 --- /dev/null +++ b/nobel_winners/node_modules/csv-stringify/README.md @@ -0,0 +1,63 @@ +[![Build Status](https://secure.travis-ci.org/wdavidw/node-csv-stringify.png)](http://travis-ci.org/wdavidw/node-csv-stringify) + +Part of the [CSV module][csv_home], this project is a stringifier converting +arrays or objects input into a CSV text. It implements the Node.js +[`stream.Transform` API][stream_transform]. It also provides a simple +callback-based API for convenience. It is both extremely easy to use and +powerful. It was first released in 2010 and is used against big data sets by a +large community. + +[Documentation for the "csv-stringify" package is available here][home]. + +## Features + +* Follow the Node.js streaming API +* Simplicity with the optional callback API +* Support for custom formatters, delimiters, quotes, escape characters and header +* Support big datasets +* Complete test coverage and samples for inspiration +* no external dependencies +* to be used conjointly with `csv-generate`, `csv-parse` and `stream-transform` +* BSD License + +Usage +----- + +Refer to the [project webpage][home] for [an exhaustive list of options][home] +and [some usage examples][examples]. + +The module is built on the Node.js Stream API. For the sake of simplify, a +simple callback API is also provided. To give you a quick look, here's an +example of the callback API: + +```javascript +var stringify = require('csv-stringify'); + +input = [ [ '1', '2', '3', '4' ], [ 'a', 'b', 'c', 'd' ] ]; +stringify(input, function(err, output){ + output.should.eql('1,2,3,4\na,b,c,d'); +}); +``` + +Development +----------- + +Tests are executed with mocha. To install it, simple run `npm install` +followed by `npm test`. It will install mocha and its dependencies in your +project "node_modules" directory and run the test suite. The tests run +against the CoffeeScript source files. + +To generate the JavaScript files, run `npm run coffee`. + +The test suite is run online with [Travis][travis] against the versions +0.10, 0.11 and 0.12 of Node.js. + +Contributors +------------ + +* David Worms: + +[home]: http://csv.adaltas.com/stringify/ +[examples]: http://csv.adaltas.com/stringify/examples/ +[csv]: https://github.com/wdavidw/node-csv +[travis]: https://travis-ci.org/#!/wdavidw/node-csv-stringify diff --git a/nobel_winners/node_modules/csv-stringify/lib/index.js b/nobel_winners/node_modules/csv-stringify/lib/index.js new file mode 100644 index 0000000..5eca661 --- /dev/null +++ b/nobel_winners/node_modules/csv-stringify/lib/index.js @@ -0,0 +1,309 @@ +// Generated by CoffeeScript 1.10.0 +var Stringifier, get, stream, util; + +stream = require('stream'); + +util = require('util'); + +get = require('lodash.get'); + +module.exports = function() { + var callback, chunks, data, options, stringifier; + if (arguments.length === 3) { + data = arguments[0]; + options = arguments[1]; + callback = arguments[2]; + } else if (arguments.length === 2) { + if (Array.isArray(arguments[0])) { + data = arguments[0]; + } else { + options = arguments[0]; + } + if (typeof arguments[1] === 'function') { + callback = arguments[1]; + } else { + options = arguments[1]; + } + } else if (arguments.length === 1) { + if (typeof arguments[0] === 'function') { + callback = arguments[0]; + } else if (Array.isArray(arguments[0])) { + data = arguments[0]; + } else { + options = arguments[0]; + } + } + if (options == null) { + options = {}; + } + stringifier = new Stringifier(options); + if (data) { + process.nextTick(function() { + var d, j, len; + for (j = 0, len = data.length; j < len; j++) { + d = data[j]; + stringifier.write(d); + } + return stringifier.end(); + }); + } + if (callback) { + chunks = []; + stringifier.on('readable', function() { + var chunk, results; + results = []; + while (chunk = stringifier.read()) { + results.push(chunks.push(chunk)); + } + return results; + }); + stringifier.on('error', function(err) { + return callback(err); + }); + stringifier.on('end', function() { + return callback(null, chunks.join('')); + }); + } + return stringifier; +}; + +Stringifier = function(opts) { + var base, base1, base10, base11, base12, base2, base3, base4, base5, base6, base7, base8, base9, k, options, v; + if (opts == null) { + opts = {}; + } + options = {}; + for (k in opts) { + v = opts[k]; + options[k] = v; + } + stream.Transform.call(this, options); + this.options = options; + if ((base = this.options).delimiter == null) { + base.delimiter = ','; + } + if ((base1 = this.options).quote == null) { + base1.quote = '"'; + } + if ((base2 = this.options).quoted == null) { + base2.quoted = false; + } + if ((base3 = this.options).quotedString == null) { + base3.quotedString = false; + } + if ((base4 = this.options).eof == null) { + base4.eof = true; + } + if ((base5 = this.options).escape == null) { + base5.escape = '"'; + } + if ((base6 = this.options).columns == null) { + base6.columns = null; + } + if ((base7 = this.options).header == null) { + base7.header = false; + } + if ((base8 = this.options).formatters == null) { + base8.formatters = {}; + } + if ((base9 = this.options.formatters).date == null) { + base9.date = function(value) { + return '' + value.getTime(); + }; + } + if ((base10 = this.options.formatters).bool == null) { + base10.bool = function(value) { + if (value) { + return '1'; + } else { + return ''; + } + }; + } + if ((base11 = this.options.formatters).object == null) { + base11.object = function(value) { + return JSON.stringify(value); + }; + } + if ((base12 = this.options).rowDelimiter == null) { + base12.rowDelimiter = '\n'; + } + if (this.countWriten == null) { + this.countWriten = 0; + } + switch (this.options.rowDelimiter) { + case 'auto': + this.options.rowDelimiter = null; + break; + case 'unix': + this.options.rowDelimiter = "\n"; + break; + case 'mac': + this.options.rowDelimiter = "\r"; + break; + case 'windows': + this.options.rowDelimiter = "\r\n"; + break; + case 'unicode': + this.options.rowDelimiter = "\u2028"; + } + return this; +}; + +util.inherits(Stringifier, stream.Transform); + +module.exports.Stringifier = Stringifier; + +Stringifier.prototype.headers = function() { + var k, label, labels; + if (!this.options.header) { + return; + } + if (!this.options.columns) { + return; + } + labels = this.options.columns; + if (typeof labels === 'object') { + labels = (function() { + var results; + results = []; + for (k in labels) { + label = labels[k]; + results.push(label); + } + return results; + })(); + } + if (this.options.eof) { + labels = this.stringify(labels) + this.options.rowDelimiter; + } else { + labels = this.stringify(labels); + } + return stream.Transform.prototype.write.call(this, labels); +}; + +Stringifier.prototype.end = function(chunk, encoding, callback) { + if (this.countWriten === 0) { + this.headers(); + } + return stream.Transform.prototype.end.apply(this, arguments); +}; + +Stringifier.prototype.write = function(chunk, encoding, callback) { + var base, e, error, preserve; + if (chunk == null) { + return; + } + preserve = typeof chunk !== 'object'; + if (!preserve) { + if (this.countWriten === 0 && !Array.isArray(chunk)) { + if ((base = this.options).columns == null) { + base.columns = Object.keys(chunk); + } + } + try { + this.emit('record', chunk, this.countWriten); + } catch (error) { + e = error; + return this.emit('error', e); + } + if (this.options.eof) { + chunk = this.stringify(chunk) + this.options.rowDelimiter; + } else { + chunk = this.stringify(chunk); + if (this.options.header || this.countWriten) { + chunk = this.options.rowDelimiter + chunk; + } + } + } + if (typeof chunk === 'number') { + chunk = "" + chunk; + } + if (this.countWriten === 0) { + this.headers(); + } + if (!preserve) { + this.countWriten++; + } + return stream.Transform.prototype.write.call(this, chunk, encoding, callback); +}; + +Stringifier.prototype._transform = function(chunk, encoding, callback) { + this.push(chunk); + return callback(); +}; + +Stringifier.prototype.stringify = function(line) { + var _line, column, columns, containsEscape, containsLinebreak, containsQuote, containsdelimiter, delimiter, escape, field, i, j, l, newLine, quote, ref, ref1, regexp, shouldQuote, value; + if (typeof line !== 'object') { + return line; + } + columns = this.options.columns; + if (typeof columns === 'object' && columns !== null && !Array.isArray(columns)) { + columns = Object.keys(columns); + } + delimiter = this.options.delimiter; + quote = this.options.quote; + escape = this.options.escape; + if (!Array.isArray(line)) { + _line = []; + if (columns) { + for (i = j = 0, ref = columns.length; 0 <= ref ? j < ref : j > ref; i = 0 <= ref ? ++j : --j) { + column = columns[i]; + value = get(line, column); + _line[i] = typeof value === 'undefined' || value === null ? '' : value; + } + } else { + for (column in line) { + _line.push(line[column]); + } + } + line = _line; + _line = null; + } else if (columns) { + line.splice(columns.length); + } + if (Array.isArray(line)) { + newLine = ''; + for (i = l = 0, ref1 = line.length; 0 <= ref1 ? l < ref1 : l > ref1; i = 0 <= ref1 ? ++l : --l) { + field = line[i]; + if (typeof field === 'string') { + + } else if (typeof field === 'number') { + field = '' + field; + } else if (typeof field === 'boolean') { + field = this.options.formatters.bool(field); + } else if (field instanceof Date) { + field = this.options.formatters.date(field); + } else if (typeof field === 'object' && field !== null) { + field = this.options.formatters.object(field); + } + if (field) { + containsdelimiter = field.indexOf(delimiter) >= 0; + containsQuote = field.indexOf(quote) >= 0; + containsEscape = field.indexOf(escape) >= 0 && (escape !== quote); + containsLinebreak = field.indexOf('\r') >= 0 || field.indexOf('\n') >= 0; + shouldQuote = containsQuote || containsdelimiter || containsLinebreak || this.options.quoted || (this.options.quotedString && typeof line[i] === 'string'); + if (shouldQuote && containsEscape) { + regexp = escape === '\\' ? new RegExp(escape + escape, 'g') : new RegExp(escape, 'g'); + field = field.replace(regexp, escape + escape); + } + if (containsQuote) { + regexp = new RegExp(quote, 'g'); + field = field.replace(regexp, escape + quote); + } + if (shouldQuote) { + field = quote + field + quote; + } + newLine += field; + } else if (this.options.quotedEmpty || ((this.options.quotedEmpty == null) && line[i] === '' && this.options.quotedString)) { + newLine += quote + quote; + } + if (i !== line.length - 1) { + newLine += delimiter; + } + } + line = newLine; + } + return line; +}; diff --git a/nobel_winners/node_modules/csv-stringify/lib/sync.js b/nobel_winners/node_modules/csv-stringify/lib/sync.js new file mode 100644 index 0000000..538bbf5 --- /dev/null +++ b/nobel_winners/node_modules/csv-stringify/lib/sync.js @@ -0,0 +1,30 @@ +// Generated by CoffeeScript 1.10.0 +var StringDecoder, stringify; + +StringDecoder = require('string_decoder').StringDecoder; + +stringify = require('./index'); + +module.exports = function(records, options) { + var data, decoder, i, len, record, stringifier; + if (options == null) { + options = {}; + } + data = []; + if (records instanceof Buffer) { + decoder = new StringDecoder(); + records = decoder.write(records); + } + stringifier = new stringify.Stringifier(options); + stringifier.push = function(record) { + if (record) { + return data.push(record.toString()); + } + }; + for (i = 0, len = records.length; i < len; i++) { + record = records[i]; + stringifier.write(record); + } + stringifier.end(); + return data.join(''); +}; diff --git a/nobel_winners/node_modules/csv-stringify/package.json b/nobel_winners/node_modules/csv-stringify/package.json new file mode 100644 index 0000000..4e293e3 --- /dev/null +++ b/nobel_winners/node_modules/csv-stringify/package.json @@ -0,0 +1,91 @@ +{ + "_args": [ + [ + { + "raw": "csv-stringify@^1.0.0", + "scope": null, + "escapedName": "csv-stringify", + "name": "csv-stringify", + "rawSpec": "^1.0.0", + "spec": ">=1.0.0 <2.0.0", + "type": "range" + }, + "/Users/heatherdesigns/gemcityjs/collaborative-may/nobel_winners/node_modules/csv" + ] + ], + "_from": "csv-stringify@>=1.0.0 <2.0.0", + "_id": "csv-stringify@1.0.4", + "_inCache": true, + "_location": "/csv-stringify", + "_nodeVersion": "6.0.0", + "_npmOperationalInternal": { + "host": "packages-12-west.internal.npmjs.com", + "tmp": "tmp/csv-stringify-1.0.4.tgz_1462998218169_0.9001891198568046" + }, + "_npmUser": { + "name": "david", + "email": "david@adaltas.com" + }, + "_npmVersion": "3.8.6", + "_phantomChildren": {}, + "_requested": { + "raw": "csv-stringify@^1.0.0", + "scope": null, + "escapedName": "csv-stringify", + "name": "csv-stringify", + "rawSpec": "^1.0.0", + "spec": ">=1.0.0 <2.0.0", + "type": "range" + }, + "_requiredBy": [ + "/csv" + ], + "_resolved": "https://registry.npmjs.org/csv-stringify/-/csv-stringify-1.0.4.tgz", + "_shasum": "bc18bab9ad4cef3195fd257980b58b479c42d3e5", + "_shrinkwrap": null, + "_spec": "csv-stringify@^1.0.0", + "_where": "/Users/heatherdesigns/gemcityjs/collaborative-may/nobel_winners/node_modules/csv", + "dependencies": { + "lodash.get": "^4.0.0" + }, + "description": "CSV stringifier implementing the Node.js `stream.Transform` API", + "devDependencies": { + "coffee-script": "latest", + "csv-generate": "latest", + "mocha": "latest", + "should": "latest" + }, + "directories": {}, + "dist": { + "shasum": "bc18bab9ad4cef3195fd257980b58b479c42d3e5", + "tarball": "https://registry.npmjs.org/csv-stringify/-/csv-stringify-1.0.4.tgz" + }, + "gitHead": "35706bc22bfb39803e46e379acdcbcc2946459ea", + "homepage": "http://csv.adaltas.com/stringify/", + "keywords": [ + "csv", + "stringify", + "stringifier" + ], + "license": "BSD-3-Clause", + "main": "./lib", + "maintainers": [ + { + "name": "david", + "email": "david@adaltas.com" + } + ], + "name": "csv-stringify", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "http://www.github.com/wdavidw/node-csv-stringify" + }, + "scripts": { + "coffee": "coffee -b -o lib src", + "pretest": "coffee -b -o lib src", + "test": "NODE_ENV=test ./node_modules/.bin/mocha --compilers coffee:coffee-script/register --reporter dot" + }, + "version": "1.0.4" +} diff --git a/nobel_winners/node_modules/csv-stringify/samples/api.callback.js b/nobel_winners/node_modules/csv-stringify/samples/api.callback.js new file mode 100644 index 0000000..8fbd530 --- /dev/null +++ b/nobel_winners/node_modules/csv-stringify/samples/api.callback.js @@ -0,0 +1,8 @@ + +should = require('should'); +stringify = require('../lib'); + +input = [ [ '1', '2', '3', '4' ], [ 'a', 'b', 'c', 'd' ] ]; +stringify(input, function(err, output){ + output.should.eql('1,2,3,4\na,b,c,d\n'); +}); diff --git a/nobel_winners/node_modules/csv-stringify/samples/api.pipe.js b/nobel_winners/node_modules/csv-stringify/samples/api.pipe.js new file mode 100644 index 0000000..8bb6f06 --- /dev/null +++ b/nobel_winners/node_modules/csv-stringify/samples/api.pipe.js @@ -0,0 +1,8 @@ + +var stringify = require('../lib'); +var generate = require('csv-generate'); + +generator = generate({objectMode: true, seed: 1, headers: 2}); +stringifier = stringify(); + +generator.pipe(stringifier).pipe(process.stdout); \ No newline at end of file diff --git a/nobel_winners/node_modules/csv-stringify/samples/api.stream.js b/nobel_winners/node_modules/csv-stringify/samples/api.stream.js new file mode 100644 index 0000000..e7d9f85 --- /dev/null +++ b/nobel_winners/node_modules/csv-stringify/samples/api.stream.js @@ -0,0 +1,23 @@ + +require('should'); +var stringify = require('../lib'); + +data = ''; +stringifier = stringify({delimiter: ':'}) +stringifier.on('readable', function(){ + while(row = stringifier.read()){ + data += row; + } +}); +stringifier.on('error', function(err){ + console.log(err.message); +}); +stringifier.on('finish', function(){ + data.should.eql( + "root:x:0:0:root:/root:/bin/bash\n" + + "someone:x:1022:1022:a funny cat:/home/someone:/bin/bash\n" + ); +}); +stringifier.write([ 'root','x','0','0','root','/root','/bin/bash' ]); +stringifier.write([ 'someone','x','1022','1022','a funny cat','/home/someone','/bin/bash' ]); +stringifier.end(); diff --git a/nobel_winners/node_modules/csv-stringify/samples/options.header.js b/nobel_winners/node_modules/csv-stringify/samples/options.header.js new file mode 100644 index 0000000..2d45ef2 --- /dev/null +++ b/nobel_winners/node_modules/csv-stringify/samples/options.header.js @@ -0,0 +1,17 @@ + +// Output looks like: +// birthYear,phone +// OMH,ONKCHhJmjadoA + +var stringify = require('../lib'); +var generate = require('csv-generate'); + +var generator = generate({objectMode: true, seed: 1, headers: 2}); + +var columns = { + year: 'birthYear', + phone: 'phone' +}; +var stringifier = stringify({ header: true, columns: columns }); + +generator.pipe(stringifier).pipe(process.stdout); diff --git a/nobel_winners/node_modules/csv-to-json/README.md b/nobel_winners/node_modules/csv-to-json/README.md new file mode 100644 index 0000000..4638dd1 --- /dev/null +++ b/nobel_winners/node_modules/csv-to-json/README.md @@ -0,0 +1,40 @@ +##csv-to-json +[![NPM Version](https://img.shields.io/npm/v/csv-to-json.svg)](https://npmjs.org/package/csv-to-json) +[![Downloads](https://img.shields.io/npm/dm/csv-to-json.svg)](https://npmjs.org/package/csv-to-json) +[![Dependencies](https://david-dm.org/alfredkam/bigData.svg)](https://david-dm.org/alfredkam/bigData) +[![Build Status](https://img.shields.io/travis/alfredkam/bigData.svg?branch=master)](https://travis-ci.org/alfredkam/bigData) +[![Coverage Status](https://coveralls.io/repos/alfredkam/bigData/badge.svg?branch=master)](https://coveralls.io/r/alfredkam/yakojs?branch=master) + +Converts your csv into json structure + +##Usage +```javascript +var csv = require('csv-to-json'); +``` +###.parse(obj, callback); +Parses the csv and returns it in JSON format +Expected parameters of +```javascript +var obj = { + filename: PATH_TO_FILE +}; +var callback = function(err, json) { + // Do something +}; +``` + +###.writeJsonToFile(obj, callback) +Writes JSON to file +```javascript +var obj = { + filename: PATH_TO_FILE, + json: JSON_OBJECT +}; + +var callback = function(err) { + // Do something +}; +``` + +###Test +```npm test``` diff --git a/nobel_winners/node_modules/csv-to-json/coverage/coverage.json b/nobel_winners/node_modules/csv-to-json/coverage/coverage.json new file mode 100644 index 0000000..46f334c --- /dev/null +++ b/nobel_winners/node_modules/csv-to-json/coverage/coverage.json @@ -0,0 +1 @@ +{"/Users/dark/git/bigData/csv-to-json/lib/csv.js":{"path":"/Users/dark/git/bigData/csv-to-json/lib/csv.js","s":{"1":1,"2":1,"3":2,"4":1,"5":1,"6":1,"7":1,"8":1,"9":0,"10":1,"11":1,"12":1,"13":3,"14":3,"15":3,"16":15,"17":15,"18":0,"19":3,"20":1,"21":1,"22":1,"23":1,"24":0,"25":1,"26":1},"b":{"1":[1,1],"2":[0,1],"3":[0,1]},"f":{"1":2,"2":1,"3":1,"4":1,"5":1},"fnMap":{"1":{"name":"(anonymous_1)","line":4,"loc":{"start":{"line":4,"column":11},"end":{"line":4,"column":31}}},"2":{"name":"(anonymous_2)","line":7,"loc":{"start":{"line":7,"column":11},"end":{"line":7,"column":35}}},"3":{"name":"(anonymous_3)","line":12,"loc":{"start":{"line":12,"column":30},"end":{"line":12,"column":51}}},"4":{"name":"(anonymous_4)","line":35,"loc":{"start":{"line":35,"column":21},"end":{"line":35,"column":45}}},"5":{"name":"(anonymous_5)","line":36,"loc":{"start":{"line":36,"column":67},"end":{"line":36,"column":81}}}},"statementMap":{"1":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}},"2":{"start":{"line":3,"column":0},"end":{"line":44,"column":2}},"3":{"start":{"line":5,"column":8},"end":{"line":5,"column":22}},"4":{"start":{"line":8,"column":8},"end":{"line":8,"column":39}},"5":{"start":{"line":9,"column":8},"end":{"line":9,"column":37}},"6":{"start":{"line":10,"column":8},"end":{"line":10,"column":22}},"7":{"start":{"line":12,"column":8},"end":{"line":31,"column":11}},"8":{"start":{"line":13,"column":12},"end":{"line":15,"column":13}},"9":{"start":{"line":14,"column":16},"end":{"line":14,"column":33}},"10":{"start":{"line":16,"column":12},"end":{"line":16,"column":58}},"11":{"start":{"line":17,"column":12},"end":{"line":17,"column":43}},"12":{"start":{"line":18,"column":12},"end":{"line":29,"column":13}},"13":{"start":{"line":19,"column":16},"end":{"line":19,"column":48}},"14":{"start":{"line":20,"column":16},"end":{"line":20,"column":29}},"15":{"start":{"line":21,"column":16},"end":{"line":27,"column":17}},"16":{"start":{"line":22,"column":20},"end":{"line":26,"column":21}},"17":{"start":{"line":23,"column":24},"end":{"line":23,"column":52}},"18":{"start":{"line":25,"column":24},"end":{"line":25,"column":44}},"19":{"start":{"line":28,"column":16},"end":{"line":28,"column":31}},"20":{"start":{"line":30,"column":12},"end":{"line":30,"column":29}},"21":{"start":{"line":33,"column":8},"end":{"line":33,"column":15}},"22":{"start":{"line":36,"column":8},"end":{"line":42,"column":11}},"23":{"start":{"line":37,"column":12},"end":{"line":39,"column":13}},"24":{"start":{"line":38,"column":16},"end":{"line":38,"column":33}},"25":{"start":{"line":40,"column":12},"end":{"line":40,"column":23}},"26":{"start":{"line":41,"column":12},"end":{"line":41,"column":19}}},"branchMap":{"1":{"line":9,"type":"binary-expr","locations":[{"start":{"line":9,"column":19},"end":{"line":9,"column":30}},{"start":{"line":9,"column":34},"end":{"line":9,"column":36}}]},"2":{"line":13,"type":"if","locations":[{"start":{"line":13,"column":12},"end":{"line":13,"column":12}},{"start":{"line":13,"column":12},"end":{"line":13,"column":12}}]},"3":{"line":37,"type":"if","locations":[{"start":{"line":37,"column":12},"end":{"line":37,"column":12}},{"start":{"line":37,"column":12},"end":{"line":37,"column":12}}]}}}} \ No newline at end of file diff --git a/nobel_winners/node_modules/csv-to-json/coverage/lcov-report/base.css b/nobel_winners/node_modules/csv-to-json/coverage/lcov-report/base.css new file mode 100644 index 0000000..7fb8827 --- /dev/null +++ b/nobel_winners/node_modules/csv-to-json/coverage/lcov-report/base.css @@ -0,0 +1,182 @@ +body, html { + margin:0; padding: 0; +} +body { + font-family: Helvetica Neue, Helvetica,Arial; + font-size: 10pt; +} +div.header, div.footer { + background: #eee; + padding: 1em; +} +div.header { + z-index: 100; + position: fixed; + top: 0; + border-bottom: 1px solid #666; + width: 100%; +} +div.footer { + border-top: 1px solid #666; +} +div.body { + margin-top: 10em; +} +div.meta { + font-size: 90%; + text-align: center; +} +h1, h2, h3 { + font-weight: normal; +} +h1 { + font-size: 12pt; +} +h2 { + font-size: 10pt; +} +pre { + font-family: Consolas, Menlo, Monaco, monospace; + margin: 0; + padding: 0; + line-height: 14px; + font-size: 14px; + -moz-tab-size: 2; + -o-tab-size: 2; + tab-size: 2; +} + +div.path { font-size: 110%; } +div.path a:link, div.path a:visited { color: #000; } +table.coverage { border-collapse: collapse; margin:0; padding: 0 } + +table.coverage td { + margin: 0; + padding: 0; + color: #111; + vertical-align: top; +} +table.coverage td.line-count { + width: 50px; + text-align: right; + padding-right: 5px; +} +table.coverage td.line-coverage { + color: #777 !important; + text-align: right; + border-left: 1px solid #666; + border-right: 1px solid #666; +} + +table.coverage td.text { +} + +table.coverage td span.cline-any { + display: inline-block; + padding: 0 5px; + width: 40px; +} +table.coverage td span.cline-neutral { + background: #eee; +} +table.coverage td span.cline-yes { + background: #b5d592; + color: #999; +} +table.coverage td span.cline-no { + background: #fc8c84; +} + +.cstat-yes { color: #111; } +.cstat-no { background: #fc8c84; color: #111; } +.fstat-no { background: #ffc520; color: #111 !important; } +.cbranch-no { background: yellow !important; color: #111; } + +.cstat-skip { background: #ddd; color: #111; } +.fstat-skip { background: #ddd; color: #111 !important; } +.cbranch-skip { background: #ddd !important; color: #111; } + +.missing-if-branch { + display: inline-block; + margin-right: 10px; + position: relative; + padding: 0 4px; + background: black; + color: yellow; +} + +.skip-if-branch { + display: none; + margin-right: 10px; + position: relative; + padding: 0 4px; + background: #ccc; + color: white; +} + +.missing-if-branch .typ, .skip-if-branch .typ { + color: inherit !important; +} + +.entity, .metric { font-weight: bold; } +.metric { display: inline-block; border: 1px solid #333; padding: 0.3em; background: white; } +.metric small { font-size: 80%; font-weight: normal; color: #666; } + +div.coverage-summary table { border-collapse: collapse; margin: 3em; font-size: 110%; } +div.coverage-summary td, div.coverage-summary table th { margin: 0; padding: 0.25em 1em; border-top: 1px solid #666; border-bottom: 1px solid #666; } +div.coverage-summary th { text-align: left; border: 1px solid #666; background: #eee; font-weight: normal; } +div.coverage-summary th.file { border-right: none !important; } +div.coverage-summary th.pic { border-left: none !important; text-align: right; } +div.coverage-summary th.pct { border-right: none !important; } +div.coverage-summary th.abs { border-left: none !important; text-align: right; } +div.coverage-summary td.pct { text-align: right; border-left: 1px solid #666; } +div.coverage-summary td.abs { text-align: right; font-size: 90%; color: #444; border-right: 1px solid #666; } +div.coverage-summary td.file { text-align: right; border-left: 1px solid #666; white-space: nowrap; } +div.coverage-summary td.pic { min-width: 120px !important; } +div.coverage-summary a:link { text-decoration: none; color: #000; } +div.coverage-summary a:visited { text-decoration: none; color: #333; } +div.coverage-summary a:hover { text-decoration: underline; } +div.coverage-summary tfoot td { border-top: 1px solid #666; } + +div.coverage-summary .sorter { + height: 10px; + width: 7px; + display: inline-block; + margin-left: 0.5em; + background: url(sort-arrow-sprite.png) no-repeat scroll 0 0 transparent; +} +div.coverage-summary .sorted .sorter { + background-position: 0 -20px; +} +div.coverage-summary .sorted-desc .sorter { + background-position: 0 -10px; +} + +.high { background: #b5d592 !important; } +.medium { background: #ffe87c !important; } +.low { background: #fc8c84 !important; } + +span.cover-fill, span.cover-empty { + display:inline-block; + border:1px solid #444; + background: white; + height: 12px; +} +span.cover-fill { + background: #ccc; + border-right: 1px solid #444; +} +span.cover-empty { + background: white; + border-left: none; +} +span.cover-full { + border-right: none !important; +} +pre.prettyprint { + border: none !important; + padding: 0 !important; + margin: 0 !important; +} +.com { color: #999 !important; } +.ignore-none { color: #999; font-weight: normal; } \ No newline at end of file diff --git a/nobel_winners/node_modules/csv-to-json/coverage/lcov-report/index.html b/nobel_winners/node_modules/csv-to-json/coverage/lcov-report/index.html new file mode 100644 index 0000000..4bbe510 --- /dev/null +++ b/nobel_winners/node_modules/csv-to-json/coverage/lcov-report/index.html @@ -0,0 +1,85 @@ + + + + Code coverage report for All files + + + + + + + + +
+

Code coverage report for All files

+

+ + Statements: 88.46% (23 / 26)      + + + Branches: 66.67% (4 / 6)      + + + Functions: 100% (5 / 5)      + + + Lines: 88.46% (23 / 26)      + + Ignored: none      +

+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FileStatementsBranchesFunctionsLines
lib/88.46%(23 / 26)66.67%(4 / 6)100%(5 / 5)88.46%(23 / 26)
+
+
+ + + + + + + + diff --git a/nobel_winners/node_modules/csv-to-json/coverage/lcov-report/lib/csv.js.html b/nobel_winners/node_modules/csv-to-json/coverage/lcov-report/lib/csv.js.html new file mode 100644 index 0000000..77399af --- /dev/null +++ b/nobel_winners/node_modules/csv-to-json/coverage/lcov-report/lib/csv.js.html @@ -0,0 +1,189 @@ + + + + Code coverage report for lib/csv.js + + + + + + + + +
+

Code coverage report for lib/csv.js

+

+ + Statements: 88.46% (23 / 26)      + + + Branches: 66.67% (4 / 6)      + + + Functions: 100% (5 / 5)      + + + Lines: 88.46% (23 / 26)      + + Ignored: none      +

+
All files » lib/ » csv.js
+
+
+

+
+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +451 +  +1 +  +2 +  +  +1 +1 +1 +  +1 +1 +  +  +1 +1 +1 +3 +3 +3 +15 +15 +  +  +  +  +3 +  +1 +  +  +1 +  +  +1 +1 +  +  +1 +1 +  +  +  + 
var fs = require('fs');
+ 
+module.exports = {
+    setfs: function (fsModule) {
+        fs = fsModule;
+    },
+    parse: function (config, next) {
+        var filename = config.filename;
+        var opts = config.opts || {};   // options to enable configurations
+        var json = [];
+ 
+        fs.readFile(filename, function (err, data) {
+            Iif (err) {
+                return next(err);
+            }
+            var csv = data.toString().split(/\r\n|\n|\r/);
+            var tokens = csv[0].split(",");
+            for(var i=1;i < csv.length;i++) {
+                var content = csv[i].split(",");
+                var tmp = {};
+                for(var j=0;j < tokens.length; j++) {
+                    try {
+                        tmp[tokens[j]] = content[j];
+                    } catch(err) {
+                        tmp[tokens[j]] = "";
+                    }
+                }
+                json.push(tmp);
+            }
+            next(null, json);
+        });
+        
+        return;
+    },
+    writeJsonToFile: function (config, next) {
+        fs.writeFile(config.filename, JSON.stringify(config.json), function(err) {
+            Iif (err) {
+                return next(err);
+            }
+            next(null);
+            return;
+        });
+    }
+};
+ 
+ +
+ + + + + + + + diff --git a/nobel_winners/node_modules/csv-to-json/coverage/lcov-report/lib/index.html b/nobel_winners/node_modules/csv-to-json/coverage/lcov-report/lib/index.html new file mode 100644 index 0000000..adf1962 --- /dev/null +++ b/nobel_winners/node_modules/csv-to-json/coverage/lcov-report/lib/index.html @@ -0,0 +1,85 @@ + + + + Code coverage report for lib/ + + + + + + + + +
+

Code coverage report for lib/

+

+ + Statements: 88.46% (23 / 26)      + + + Branches: 66.67% (4 / 6)      + + + Functions: 100% (5 / 5)      + + + Lines: 88.46% (23 / 26)      + + Ignored: none      +

+
All files » lib/
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FileStatementsBranchesFunctionsLines
csv.js88.46%(23 / 26)66.67%(4 / 6)100%(5 / 5)88.46%(23 / 26)
+
+
+ + + + + + + + diff --git a/nobel_winners/node_modules/csv-to-json/coverage/lcov-report/prettify.css b/nobel_winners/node_modules/csv-to-json/coverage/lcov-report/prettify.css new file mode 100644 index 0000000..b317a7c --- /dev/null +++ b/nobel_winners/node_modules/csv-to-json/coverage/lcov-report/prettify.css @@ -0,0 +1 @@ +.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee} diff --git a/nobel_winners/node_modules/csv-to-json/coverage/lcov-report/prettify.js b/nobel_winners/node_modules/csv-to-json/coverage/lcov-report/prettify.js new file mode 100644 index 0000000..ef51e03 --- /dev/null +++ b/nobel_winners/node_modules/csv-to-json/coverage/lcov-report/prettify.js @@ -0,0 +1 @@ +window.PR_SHOULD_USE_CONTINUATION=true;(function(){var h=["break,continue,do,else,for,if,return,while"];var u=[h,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"];var p=[u,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"];var l=[p,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"];var x=[p,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"];var R=[x,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"];var r="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes";var w=[p,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"];var s="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END";var I=[h,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"];var f=[h,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"];var H=[h,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"];var A=[l,R,w,s+I,f,H];var e=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/;var C="str";var z="kwd";var j="com";var O="typ";var G="lit";var L="pun";var F="pln";var m="tag";var E="dec";var J="src";var P="atn";var n="atv";var N="nocode";var M="(?:^^\\.?|[+-]|\\!|\\!=|\\!==|\\#|\\%|\\%=|&|&&|&&=|&=|\\(|\\*|\\*=|\\+=|\\,|\\-=|\\->|\\/|\\/=|:|::|\\;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|\\?|\\@|\\[|\\^|\\^=|\\^\\^|\\^\\^=|\\{|\\||\\|=|\\|\\||\\|\\|=|\\~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function k(Z){var ad=0;var S=false;var ac=false;for(var V=0,U=Z.length;V122)){if(!(al<65||ag>90)){af.push([Math.max(65,ag)|32,Math.min(al,90)|32])}if(!(al<97||ag>122)){af.push([Math.max(97,ag)&~32,Math.min(al,122)&~32])}}}}af.sort(function(av,au){return(av[0]-au[0])||(au[1]-av[1])});var ai=[];var ap=[NaN,NaN];for(var ar=0;arat[0]){if(at[1]+1>at[0]){an.push("-")}an.push(T(at[1]))}}an.push("]");return an.join("")}function W(al){var aj=al.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g"));var ah=aj.length;var an=[];for(var ak=0,am=0;ak=2&&ai==="["){aj[ak]=X(ag)}else{if(ai!=="\\"){aj[ak]=ag.replace(/[a-zA-Z]/g,function(ao){var ap=ao.charCodeAt(0);return"["+String.fromCharCode(ap&~32,ap|32)+"]"})}}}}return aj.join("")}var aa=[];for(var V=0,U=Z.length;V=0;){S[ac.charAt(ae)]=Y}}var af=Y[1];var aa=""+af;if(!ag.hasOwnProperty(aa)){ah.push(af);ag[aa]=null}}ah.push(/[\0-\uffff]/);V=k(ah)})();var X=T.length;var W=function(ah){var Z=ah.sourceCode,Y=ah.basePos;var ad=[Y,F];var af=0;var an=Z.match(V)||[];var aj={};for(var ae=0,aq=an.length;ae=5&&"lang-"===ap.substring(0,5);if(am&&!(ai&&typeof ai[1]==="string")){am=false;ap=J}if(!am){aj[ag]=ap}}var ab=af;af+=ag.length;if(!am){ad.push(Y+ab,ap)}else{var al=ai[1];var ak=ag.indexOf(al);var ac=ak+al.length;if(ai[2]){ac=ag.length-ai[2].length;ak=ac-al.length}var ar=ap.substring(5);B(Y+ab,ag.substring(0,ak),W,ad);B(Y+ab+ak,al,q(ar,al),ad);B(Y+ab+ac,ag.substring(ac),W,ad)}}ah.decorations=ad};return W}function i(T){var W=[],S=[];if(T.tripleQuotedStrings){W.push([C,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,"'\""])}else{if(T.multiLineStrings){W.push([C,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"])}else{W.push([C,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,"\"'"])}}if(T.verbatimStrings){S.push([C,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null])}var Y=T.hashComments;if(Y){if(T.cStyleComments){if(Y>1){W.push([j,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"])}else{W.push([j,/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"])}S.push([C,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,null])}else{W.push([j,/^#[^\r\n]*/,null,"#"])}}if(T.cStyleComments){S.push([j,/^\/\/[^\r\n]*/,null]);S.push([j,/^\/\*[\s\S]*?(?:\*\/|$)/,null])}if(T.regexLiterals){var X=("/(?=[^/*])(?:[^/\\x5B\\x5C]|\\x5C[\\s\\S]|\\x5B(?:[^\\x5C\\x5D]|\\x5C[\\s\\S])*(?:\\x5D|$))+/");S.push(["lang-regex",new RegExp("^"+M+"("+X+")")])}var V=T.types;if(V){S.push([O,V])}var U=(""+T.keywords).replace(/^ | $/g,"");if(U.length){S.push([z,new RegExp("^(?:"+U.replace(/[\s,]+/g,"|")+")\\b"),null])}W.push([F,/^\s+/,null," \r\n\t\xA0"]);S.push([G,/^@[a-z_$][a-z_$@0-9]*/i,null],[O,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[F,/^[a-z_$][a-z_$@0-9]*/i,null],[G,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[F,/^\\[\s\S]?/,null],[L,/^.[^\s\w\.$@\'\"\`\/\#\\]*/,null]);return g(W,S)}var K=i({keywords:A,hashComments:true,cStyleComments:true,multiLineStrings:true,regexLiterals:true});function Q(V,ag){var U=/(?:^|\s)nocode(?:\s|$)/;var ab=/\r\n?|\n/;var ac=V.ownerDocument;var S;if(V.currentStyle){S=V.currentStyle.whiteSpace}else{if(window.getComputedStyle){S=ac.defaultView.getComputedStyle(V,null).getPropertyValue("white-space")}}var Z=S&&"pre"===S.substring(0,3);var af=ac.createElement("LI");while(V.firstChild){af.appendChild(V.firstChild)}var W=[af];function ae(al){switch(al.nodeType){case 1:if(U.test(al.className)){break}if("BR"===al.nodeName){ad(al);if(al.parentNode){al.parentNode.removeChild(al)}}else{for(var an=al.firstChild;an;an=an.nextSibling){ae(an)}}break;case 3:case 4:if(Z){var am=al.nodeValue;var aj=am.match(ab);if(aj){var ai=am.substring(0,aj.index);al.nodeValue=ai;var ah=am.substring(aj.index+aj[0].length);if(ah){var ak=al.parentNode;ak.insertBefore(ac.createTextNode(ah),al.nextSibling)}ad(al);if(!ai){al.parentNode.removeChild(al)}}}break}}function ad(ak){while(!ak.nextSibling){ak=ak.parentNode;if(!ak){return}}function ai(al,ar){var aq=ar?al.cloneNode(false):al;var ao=al.parentNode;if(ao){var ap=ai(ao,1);var an=al.nextSibling;ap.appendChild(aq);for(var am=an;am;am=an){an=am.nextSibling;ap.appendChild(am)}}return aq}var ah=ai(ak.nextSibling,0);for(var aj;(aj=ah.parentNode)&&aj.nodeType===1;){ah=aj}W.push(ah)}for(var Y=0;Y=S){ah+=2}if(V>=ap){Z+=2}}}var t={};function c(U,V){for(var S=V.length;--S>=0;){var T=V[S];if(!t.hasOwnProperty(T)){t[T]=U}else{if(window.console){console.warn("cannot override language handler %s",T)}}}}function q(T,S){if(!(T&&t.hasOwnProperty(T))){T=/^\s*]*(?:>|$)/],[j,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[L,/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]);c(g([[F,/^[\s]+/,null," \t\r\n"],[n,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,"\"'"]],[[m,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[P,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[L,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]);c(g([],[[n,/^[\s\S]+/]]),["uq.val"]);c(i({keywords:l,hashComments:true,cStyleComments:true,types:e}),["c","cc","cpp","cxx","cyc","m"]);c(i({keywords:"null,true,false"}),["json"]);c(i({keywords:R,hashComments:true,cStyleComments:true,verbatimStrings:true,types:e}),["cs"]);c(i({keywords:x,cStyleComments:true}),["java"]);c(i({keywords:H,hashComments:true,multiLineStrings:true}),["bsh","csh","sh"]);c(i({keywords:I,hashComments:true,multiLineStrings:true,tripleQuotedStrings:true}),["cv","py"]);c(i({keywords:s,hashComments:true,multiLineStrings:true,regexLiterals:true}),["perl","pl","pm"]);c(i({keywords:f,hashComments:true,multiLineStrings:true,regexLiterals:true}),["rb"]);c(i({keywords:w,cStyleComments:true,regexLiterals:true}),["js"]);c(i({keywords:r,hashComments:3,cStyleComments:true,multilineStrings:true,tripleQuotedStrings:true,regexLiterals:true}),["coffee"]);c(g([],[[C,/^[\s\S]+/]]),["regex"]);function d(V){var U=V.langExtension;try{var S=a(V.sourceNode);var T=S.sourceCode;V.sourceCode=T;V.spans=S.spans;V.basePos=0;q(U,T)(V);D(V)}catch(W){if("console" in window){console.log(W&&W.stack?W.stack:W)}}}function y(W,V,U){var S=document.createElement("PRE");S.innerHTML=W;if(U){Q(S,U)}var T={langExtension:V,numberLines:U,sourceNode:S};d(T);return S.innerHTML}function b(ad){function Y(af){return document.getElementsByTagName(af)}var ac=[Y("pre"),Y("code"),Y("xmp")];var T=[];for(var aa=0;aa=0){var ah=ai.match(ab);var am;if(!ah&&(am=o(aj))&&"CODE"===am.tagName){ah=am.className.match(ab)}if(ah){ah=ah[1]}var al=false;for(var ak=aj.parentNode;ak;ak=ak.parentNode){if((ak.tagName==="pre"||ak.tagName==="code"||ak.tagName==="xmp")&&ak.className&&ak.className.indexOf("prettyprint")>=0){al=true;break}}if(!al){var af=aj.className.match(/\blinenums\b(?::(\d+))?/);af=af?af[1]&&af[1].length?+af[1]:true:false;if(af){Q(aj,af)}S={langExtension:ah,sourceNode:aj,numberLines:af};d(S)}}}if(X]*(?:>|$)/],[PR.PR_COMMENT,/^<\!--[\s\S]*?(?:-\->|$)/],[PR.PR_PUNCTUATION,/^(?:<[%?]|[%?]>)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-handlebars",/^]*type\s*=\s*['"]?text\/x-handlebars-template['"]?\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i],[PR.PR_DECLARATION,/^{{[#^>/]?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{&?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{{>?\s*[\w.][^}]*}}}/],[PR.PR_COMMENT,/^{{![^}]*}}/]]),["handlebars","hbs"]);PR.registerLangHandler(PR.createSimpleLexer([[PR.PR_PLAIN,/^[ \t\r\n\f]+/,null," \t\r\n\f"]],[[PR.PR_STRING,/^\"(?:[^\n\r\f\\\"]|\\(?:\r\n?|\n|\f)|\\[\s\S])*\"/,null],[PR.PR_STRING,/^\'(?:[^\n\r\f\\\']|\\(?:\r\n?|\n|\f)|\\[\s\S])*\'/,null],["lang-css-str",/^url\(([^\)\"\']*)\)/i],[PR.PR_KEYWORD,/^(?:url|rgb|\!important|@import|@page|@media|@charset|inherit)(?=[^\-\w]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|(?:\\[0-9a-f]+ ?))(?:[_a-z0-9\-]|\\(?:\\[0-9a-f]+ ?))*)\s*:/i],[PR.PR_COMMENT,/^\/\*[^*]*\*+(?:[^\/*][^*]*\*+)*\//],[PR.PR_COMMENT,/^(?:)/],[PR.PR_LITERAL,/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],[PR.PR_LITERAL,/^#(?:[0-9a-f]{3}){1,2}/i],[PR.PR_PLAIN,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i],[PR.PR_PUNCTUATION,/^[^\s\w\'\"]+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_KEYWORD,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_STRING,/^[^\)\"\']+/]]),["css-str"]); diff --git a/nobel_winners/node_modules/csv-to-json/coverage/lcov-report/sort-arrow-sprite.png b/nobel_winners/node_modules/csv-to-json/coverage/lcov-report/sort-arrow-sprite.png new file mode 100644 index 0000000..03f704a Binary files /dev/null and b/nobel_winners/node_modules/csv-to-json/coverage/lcov-report/sort-arrow-sprite.png differ diff --git a/nobel_winners/node_modules/csv-to-json/coverage/lcov-report/sorter.js b/nobel_winners/node_modules/csv-to-json/coverage/lcov-report/sorter.js new file mode 100644 index 0000000..6afb736 --- /dev/null +++ b/nobel_winners/node_modules/csv-to-json/coverage/lcov-report/sorter.js @@ -0,0 +1,156 @@ +var addSorting = (function () { + "use strict"; + var cols, + currentSort = { + index: 0, + desc: false + }; + + // returns the summary table element + function getTable() { return document.querySelector('.coverage-summary table'); } + // returns the thead element of the summary table + function getTableHeader() { return getTable().querySelector('thead tr'); } + // returns the tbody element of the summary table + function getTableBody() { return getTable().querySelector('tbody'); } + // returns the th element for nth column + function getNthColumn(n) { return getTableHeader().querySelectorAll('th')[n]; } + + // loads all columns + function loadColumns() { + var colNodes = getTableHeader().querySelectorAll('th'), + colNode, + cols = [], + col, + i; + + for (i = 0; i < colNodes.length; i += 1) { + colNode = colNodes[i]; + col = { + key: colNode.getAttribute('data-col'), + sortable: !colNode.getAttribute('data-nosort'), + type: colNode.getAttribute('data-type') || 'string' + }; + cols.push(col); + if (col.sortable) { + col.defaultDescSort = col.type === 'number'; + colNode.innerHTML = colNode.innerHTML + ''; + } + } + return cols; + } + // attaches a data attribute to every tr element with an object + // of data values keyed by column name + function loadRowData(tableRow) { + var tableCols = tableRow.querySelectorAll('td'), + colNode, + col, + data = {}, + i, + val; + for (i = 0; i < tableCols.length; i += 1) { + colNode = tableCols[i]; + col = cols[i]; + val = colNode.getAttribute('data-value'); + if (col.type === 'number') { + val = Number(val); + } + data[col.key] = val; + } + return data; + } + // loads all row data + function loadData() { + var rows = getTableBody().querySelectorAll('tr'), + i; + + for (i = 0; i < rows.length; i += 1) { + rows[i].data = loadRowData(rows[i]); + } + } + // sorts the table using the data for the ith column + function sortByIndex(index, desc) { + var key = cols[index].key, + sorter = function (a, b) { + a = a.data[key]; + b = b.data[key]; + return a < b ? -1 : a > b ? 1 : 0; + }, + finalSorter = sorter, + tableBody = document.querySelector('.coverage-summary tbody'), + rowNodes = tableBody.querySelectorAll('tr'), + rows = [], + i; + + if (desc) { + finalSorter = function (a, b) { + return -1 * sorter(a, b); + }; + } + + for (i = 0; i < rowNodes.length; i += 1) { + rows.push(rowNodes[i]); + tableBody.removeChild(rowNodes[i]); + } + + rows.sort(finalSorter); + + for (i = 0; i < rows.length; i += 1) { + tableBody.appendChild(rows[i]); + } + } + // removes sort indicators for current column being sorted + function removeSortIndicators() { + var col = getNthColumn(currentSort.index), + cls = col.className; + + cls = cls.replace(/ sorted$/, '').replace(/ sorted-desc$/, ''); + col.className = cls; + } + // adds sort indicators for current column being sorted + function addSortIndicators() { + getNthColumn(currentSort.index).className += currentSort.desc ? ' sorted-desc' : ' sorted'; + } + // adds event listeners for all sorter widgets + function enableUI() { + var i, + el, + ithSorter = function ithSorter(i) { + var col = cols[i]; + + return function () { + var desc = col.defaultDescSort; + + if (currentSort.index === i) { + desc = !currentSort.desc; + } + sortByIndex(i, desc); + removeSortIndicators(); + currentSort.index = i; + currentSort.desc = desc; + addSortIndicators(); + }; + }; + for (i =0 ; i < cols.length; i += 1) { + if (cols[i].sortable) { + el = getNthColumn(i).querySelector('.sorter'); + if (el.addEventListener) { + el.addEventListener('click', ithSorter(i)); + } else { + el.attachEvent('onclick', ithSorter(i)); + } + } + } + } + // adds sorting functionality to the UI + return function () { + if (!getTable()) { + return; + } + cols = loadColumns(); + loadData(cols); + addSortIndicators(); + enableUI(); + }; +})(); + +window.addEventListener('load', addSorting); diff --git a/nobel_winners/node_modules/csv-to-json/coverage/lcov.info b/nobel_winners/node_modules/csv-to-json/coverage/lcov.info new file mode 100644 index 0000000..a755fbf --- /dev/null +++ b/nobel_winners/node_modules/csv-to-json/coverage/lcov.info @@ -0,0 +1,51 @@ +TN: +SF:/Users/dark/git/bigData/csv-to-json/lib/csv.js +FN:4,(anonymous_1) +FN:7,(anonymous_2) +FN:12,(anonymous_3) +FN:35,(anonymous_4) +FN:36,(anonymous_5) +FNF:5 +FNH:5 +FNDA:2,(anonymous_1) +FNDA:1,(anonymous_2) +FNDA:1,(anonymous_3) +FNDA:1,(anonymous_4) +FNDA:1,(anonymous_5) +DA:1,1 +DA:3,1 +DA:5,2 +DA:8,1 +DA:9,1 +DA:10,1 +DA:12,1 +DA:13,1 +DA:14,0 +DA:16,1 +DA:17,1 +DA:18,1 +DA:19,3 +DA:20,3 +DA:21,3 +DA:22,15 +DA:23,15 +DA:25,0 +DA:28,3 +DA:30,1 +DA:33,1 +DA:36,1 +DA:37,1 +DA:38,0 +DA:40,1 +DA:41,1 +LF:26 +LH:23 +BRDA:9,1,0,1 +BRDA:9,1,1,1 +BRDA:13,2,0,0 +BRDA:13,2,1,1 +BRDA:37,3,0,0 +BRDA:37,3,1,1 +BRF:6 +BRH:4 +end_of_record diff --git a/nobel_winners/node_modules/csv-to-json/index.js b/nobel_winners/node_modules/csv-to-json/index.js new file mode 100644 index 0000000..86a1baa --- /dev/null +++ b/nobel_winners/node_modules/csv-to-json/index.js @@ -0,0 +1,2 @@ +// Require the sdk from the root of directory +module.exports = require('./lib/csv'); \ No newline at end of file diff --git a/nobel_winners/node_modules/csv-to-json/lib/csv.js b/nobel_winners/node_modules/csv-to-json/lib/csv.js new file mode 100644 index 0000000..2526d9f --- /dev/null +++ b/nobel_winners/node_modules/csv-to-json/lib/csv.js @@ -0,0 +1,49 @@ +var fs = require('fs'); + +module.exports = { + setfs: function (fsModule) { + fs = fsModule; + }, + parse: function (config, next) { + var filename = config.filename; + var opts = config.opts || {}; // options to enable configurations + var json = []; + + // Get comma separated sub strings, excluding those inside double quotes. + var getCommaSeparated = function (str) { + return str.split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/); + }; + + fs.readFile(filename, function (err, data) { + if (err) { + return next(err); + } + var csv = data.toString().split(/\r\n|\n|\r/); + var tokens = getCommaSeparated(csv[0]); + for(var i=1;i < csv.length;i++) { + var content = getCommaSeparated(csv[i]); + var tmp = {}; + for(var j=0;j < tokens.length; j++) { + try { + tmp[tokens[j]] = content[j]; + } catch(err) { + tmp[tokens[j]] = ""; + } + } + json.push(tmp); + } + next(null, json); + }); + + return; + }, + writeJsonToFile: function (config, next) { + fs.writeFile(config.filename, JSON.stringify(config.json), function(err) { + if (err) { + return next(err); + } + next(null); + return; + }); + } +}; diff --git a/nobel_winners/node_modules/csv-to-json/package.json b/nobel_winners/node_modules/csv-to-json/package.json new file mode 100644 index 0000000..9c61f4c --- /dev/null +++ b/nobel_winners/node_modules/csv-to-json/package.json @@ -0,0 +1,90 @@ +{ + "_args": [ + [ + { + "raw": "csv-to-json", + "scope": null, + "escapedName": "csv-to-json", + "name": "csv-to-json", + "rawSpec": "", + "spec": "latest", + "type": "tag" + }, + "/Users/heatherdesigns/gemcityjs/collaborative-may/nobel_winners" + ] + ], + "_from": "csv-to-json@latest", + "_id": "csv-to-json@0.1.2", + "_inCache": true, + "_location": "/csv-to-json", + "_npmUser": { + "name": "alfredkam", + "email": "kam.alfred@gmail.com" + }, + "_npmVersion": "1.4.6", + "_phantomChildren": {}, + "_requested": { + "raw": "csv-to-json", + "scope": null, + "escapedName": "csv-to-json", + "name": "csv-to-json", + "rawSpec": "", + "spec": "latest", + "type": "tag" + }, + "_requiredBy": [ + "#USER", + "/" + ], + "_resolved": "https://registry.npmjs.org/csv-to-json/-/csv-to-json-0.1.2.tgz", + "_shasum": "57987b50f06ead7453e722543630ff75fb9539a0", + "_shrinkwrap": null, + "_spec": "csv-to-json", + "_where": "/Users/heatherdesigns/gemcityjs/collaborative-may/nobel_winners", + "author": { + "name": "alfred kam" + }, + "dependencies": {}, + "description": "parses csv and returns it into json object", + "devDependencies": { + "chai": "^2.0.0", + "coveralls": "^2.11.2", + "istanbul": "^0.3.5", + "mocha": "^2.1.0", + "mocha-lcov-reporter": "0.0.1" + }, + "directories": {}, + "dist": { + "shasum": "57987b50f06ead7453e722543630ff75fb9539a0", + "tarball": "https://registry.npmjs.org/csv-to-json/-/csv-to-json-0.1.2.tgz" + }, + "engines": { + "node": ">=0.10.0" + }, + "keywords": [ + "csv", + "csv to json", + "json", + "json object" + ], + "license": "MIT", + "main": "csv.js", + "maintainers": [ + { + "name": "alfredkam", + "email": "kam.alfred@gmail.com" + } + ], + "name": "csv-to-json", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "https://github.com/alfredkam/bigData/tree/master/csv-to-json" + }, + "scripts": { + "coveralls": "./node_modules/istanbul/lib/cli.js cover node_modules/mocha/bin/_mocha test -- --recursive --report loconly -R spec && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage", + "test": "./node_modules/istanbul/lib/cli.js cover node_modules/mocha/bin/_mocha test -- --recursive" + }, + "version": "0.1.2" +} diff --git a/nobel_winners/node_modules/csv-to-json/test/csv-test.js b/nobel_winners/node_modules/csv-to-json/test/csv-test.js new file mode 100644 index 0000000..8076cc9 --- /dev/null +++ b/nobel_winners/node_modules/csv-to-json/test/csv-test.js @@ -0,0 +1,53 @@ +var chai = require('chai'); +var expect = chai.expect; +var csv = require('../lib/csv'); +var sampleCSV = require('./sampleCSV'); +var sampleJson = require('./sampleJson'); + +describe('csv parse test', function (){ + var fs = { + readFile: function () { + var next = arguments[arguments.length-1]; + next(null, sampleCSV); + } + }; + // mock fs + beforeEach(function () { + csv.setfs(fs); + }); + + it('should be able to parse csv', function (done) { + var json = csv.parse({ + filename: 'Sample Filename' + }, function (err, data) { + expect(data).to.be.an('array'); + expect(data).to.have.length('3'); + expect(data).to.eql(sampleJson); + done(); + }); + return; + }); +}); + +describe('csv write json test', function (){ + var fs = { + writeFile: function () { + var next = arguments[arguments.length - 1]; + next(null); + return; + } + }; + beforeEach(function () { + csv.setfs(fs); + }); + it('should be able to write csv', function (done) { + csv.writeJsonToFile({ + json: sampleJson, + filename: '' + }, function () { + done(); + }); + return; + }); +}); + \ No newline at end of file diff --git a/nobel_winners/node_modules/csv-to-json/test/sampleCSV.js b/nobel_winners/node_modules/csv-to-json/test/sampleCSV.js new file mode 100644 index 0000000..e784d03 --- /dev/null +++ b/nobel_winners/node_modules/csv-to-json/test/sampleCSV.js @@ -0,0 +1,2 @@ +var data = "Sally Whittaker,2018,McCarren House,312,3.75\nBelinda Jameson,2017,Cushing House,148,3.52\nJeff Smith,2018,Prescott House,17-D,3.20\nSandy Allen,2019,Oliver House,108,3.48"; +module.exports = data; \ No newline at end of file diff --git a/nobel_winners/node_modules/csv-to-json/test/sampleJson.js b/nobel_winners/node_modules/csv-to-json/test/sampleJson.js new file mode 100644 index 0000000..6f49298 --- /dev/null +++ b/nobel_winners/node_modules/csv-to-json/test/sampleJson.js @@ -0,0 +1,15 @@ +module.exports = [ { '312': '148', + '2018': '2017', + 'Sally Whittaker': 'Belinda Jameson', + 'McCarren House': 'Cushing House', + '3.75': '3.52' }, + { '312': '17-D', + '2018': '2018', + 'Sally Whittaker': 'Jeff Smith', + 'McCarren House': 'Prescott House', + '3.75': '3.20' }, + { '312': '108', + '2018': '2019', + 'Sally Whittaker': 'Sandy Allen', + 'McCarren House': 'Oliver House', + '3.75': '3.48' } ]; \ No newline at end of file diff --git a/nobel_winners/node_modules/csv/.npmignore b/nobel_winners/node_modules/csv/.npmignore new file mode 100644 index 0000000..b7c290d --- /dev/null +++ b/nobel_winners/node_modules/csv/.npmignore @@ -0,0 +1,8 @@ +.* +#*.tmp +/node_modules +lib-cov +samples/sample.out +samples/perf.out +!.travis.yml +!.gitignore diff --git a/nobel_winners/node_modules/csv/.travis.yml b/nobel_winners/node_modules/csv/.travis.yml new file mode 100644 index 0000000..05d299e --- /dev/null +++ b/nobel_winners/node_modules/csv/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - "0.10" + - "0.11" diff --git a/nobel_winners/node_modules/csv/LICENSE b/nobel_winners/node_modules/csv/LICENSE new file mode 100644 index 0000000..f77b58e --- /dev/null +++ b/nobel_winners/node_modules/csv/LICENSE @@ -0,0 +1,16 @@ +Software License Agreement (BSD License) +======================================== + +Copyright (c) 2011, SARL Adaltas. + +All rights reserved. + +Redistribution and use of this software in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +- Neither the name of SARL Adaltas nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission of the SARL Adaltas. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/nobel_winners/node_modules/csv/Makefile b/nobel_winners/node_modules/csv/Makefile new file mode 100644 index 0000000..5954e3a --- /dev/null +++ b/nobel_winners/node_modules/csv/Makefile @@ -0,0 +1,5 @@ + +build: + @./node_modules/.bin/coffee -b -o lib src/ + +.PHONY: test diff --git a/nobel_winners/node_modules/csv/README.md b/nobel_winners/node_modules/csv/README.md new file mode 100644 index 0000000..f3a35cd --- /dev/null +++ b/nobel_winners/node_modules/csv/README.md @@ -0,0 +1,145 @@ + +
+     _   _           _        _____  _______      __
+    | \ | |         | |      / ____|/ ____\ \    / /
+    |  \| | ___   __| | ___ | |    | (___  \ \  / /
+    | . ` |/ _ \ / _` |/ _ \| |     \___ \  \ \/ /
+    | |\  | (_) | (_| |  __/| |____ ____) |  \  /
+    |_| \_|\___/ \__,_|\___| \_____|_____/    \/     New BSD License
+
+
+ +This project provides CSV generation, parsing, transformation and serialization +for Node.js. + +It has been tested and used by a large community over the years and should be +considered reliable. It provides every option you would expect from an advanced +CSV parser and stringifier. + +[![NPM](https://nodei.co/npm/csv.png?stars&downloads)](https://nodei.co/npm/csv/) [![NPM](https://nodei.co/npm-dl/csv.png)](https://nodei.co/npm/csv/) + +The `csv` package is itself split into 4 packages: + +* [`csv-generate`](https://github.com/wdavidw/node-csv-generate), + a flexible generator of CSV string and Javascript objects. + [![Build Status](https://secure.travis-ci.org/wdavidw/node-csv-generate.svg?branch=master)][travis-csv-generate] +* [`csv-parse`](https://github.com/wdavidw/node-csv-parse), + a parser converting CSV text into arrays or objects. + [![Build Status](https://secure.travis-ci.org/wdavidw/node-csv-parse.svg?branch=master)][travis-csv-parse] +* [`stream-transform`](https://github.com/wdavidw/node-stream-transform), + a transformation framework. + [![Build Status](https://secure.travis-ci.org/wdavidw/node-stream-transform.svg?branch=master)][travis-stream-transform] +* [`csv-stringify`](https://github.com/wdavidw/node-csv-stringify), + a stringifier converting records into a CSV text. + [![Build Status](https://secure.travis-ci.org/wdavidw/node-csv-stringify.svg?branch=master)][travis-csv-stringify] + +## Documentation + +The full documentation for the current versionis available [here][new_doc] while the +previous documentation is still available [here][old_doc]. + +## Usage + +Installation command is `npm install csv`. + +Each package is fully compatible with the stream 2 and 3 specifications. +Also, a simple callback-based API is always provided for convenience. + +### Callback example + +Execute this script with the command `node samples/callback.js`. + +```javascript +var csv = require('csv'); + +csv.generate({seed: 1, columns: 2, length: 20}, function(err, data){ + csv.parse(data, function(err, data){ + csv.transform(data, function(data){ + return data.map(function(value){return value.toUpperCase()}); + }, function(err, data){ + csv.stringify(data, function(err, data){ + process.stdout.write(data); + }); + }); + }); +}); +``` + +### Stream example + +Execute this script with the command `node samples/stream.js`. + +```javascript +var csv = require('csv'); + +var generator = csv.generate({seed: 1, columns: 2, length: 20}); +var parser = csv.parse(); +var transformer = csv.transform(function(data){ + return data.map(function(value){return value.toUpperCase()}); +}); +var stringifier = csv.stringify(); + +generator.on('readable', function(){ + while(data = generator.read()){ + parser.write(data); + } +}); + +parser.on('readable', function(){ + while(data = parser.read()){ + transformer.write(data); + } +}); + +transformer.on('readable', function(){ + while(data = transformer.read()){ + stringifier.write(data); + } +}); + +stringifier.on('readable', function(){ + while(data = stringifier.read()){ + process.stdout.write(data); + } +}); +``` + +### Pipe example + +Execute this script with the command `node samples/pipe.js`. + +```javascript +var csv = require('csv'); + +csv.generate({seed: 1, columns: 2, length: 20}) + .pipe(csv.parse()) + .pipe(csv.transform(function(record){ + return record.map(function(value){ + return value.toUpperCase() + }); + })) + .pipe(csv.stringify()) + .pipe(process.stdout); +``` + +Development +----------- + +This parent project doesn't have tests itself but instead delegates the +tests to its child projects. + +Read the documentation of the child projects for additional information. + +Related projects +---------------- + +* Pavel Kolesnikov "ya-csv": +* Chris Williams "node-csv": + +[travis]: https://travis-ci.org/ +[travis-csv-generate]: http://travis-ci.org/wdavidw/node-csv-generate +[travis-csv-parse]: http://travis-ci.org/wdavidw/node-csv-parse +[travis-stream-transform]: http://travis-ci.org/wdavidw/node-stream-transform +[travis-csv-stringify]: http://travis-ci.org/wdavidw/node-csv-stringify +[new_doc]: http://csv.adaltas.com +[old_doc]: http://csv.adaltas.com/legacy/ diff --git a/nobel_winners/node_modules/csv/lib/index.js b/nobel_winners/node_modules/csv/lib/index.js new file mode 100644 index 0000000..51311ac --- /dev/null +++ b/nobel_winners/node_modules/csv/lib/index.js @@ -0,0 +1,18 @@ +// Generated by CoffeeScript 1.7.1 +var generate, parse, stringify, transform; + +generate = require('csv-generate'); + +parse = require('csv-parse'); + +transform = require('stream-transform'); + +stringify = require('csv-stringify'); + +module.exports.generate = generate; + +module.exports.parse = parse; + +module.exports.transform = transform; + +module.exports.stringify = stringify; diff --git a/nobel_winners/node_modules/csv/package.json b/nobel_winners/node_modules/csv/package.json new file mode 100644 index 0000000..727c5cc --- /dev/null +++ b/nobel_winners/node_modules/csv/package.json @@ -0,0 +1,108 @@ +{ + "_args": [ + [ + { + "raw": "csv@^1.1.1", + "scope": null, + "escapedName": "csv", + "name": "csv", + "rawSpec": "^1.1.1", + "spec": ">=1.1.1 <2.0.0", + "type": "range" + }, + "/Users/heatherdesigns/gemcityjs/collaborative-may/nobel_winners" + ] + ], + "_from": "csv@>=1.1.1 <2.0.0", + "_id": "csv@1.1.1", + "_inCache": true, + "_location": "/csv", + "_nodeVersion": "6.7.0", + "_npmOperationalInternal": { + "host": "packages-18-east.internal.npmjs.com", + "tmp": "tmp/csv-1.1.1.tgz_1485444032981_0.6298237980809063" + }, + "_npmUser": { + "name": "david", + "email": "david@adaltas.com" + }, + "_npmVersion": "3.10.3", + "_phantomChildren": {}, + "_requested": { + "raw": "csv@^1.1.1", + "scope": null, + "escapedName": "csv", + "name": "csv", + "rawSpec": "^1.1.1", + "spec": ">=1.1.1 <2.0.0", + "type": "range" + }, + "_requiredBy": [ + "#USER", + "/" + ], + "_resolved": "https://registry.npmjs.org/csv/-/csv-1.1.1.tgz", + "_shasum": "d9952d59b1f964a7afbcdd804d6818a73199a477", + "_shrinkwrap": null, + "_spec": "csv@^1.1.1", + "_where": "/Users/heatherdesigns/gemcityjs/collaborative-may/nobel_winners", + "author": { + "name": "David Worms", + "email": "david@adaltas.com", + "url": "http://www.adaltas.com" + }, + "bugs": { + "url": "https://github.com/wdavidw/node-csv/issues" + }, + "contributors": [ + { + "name": "David Worms", + "email": "david@adaltas.com", + "url": "http://www.adaltas.com" + } + ], + "dependencies": { + "csv-generate": "^1.0.0", + "csv-parse": "^1.2.0", + "csv-stringify": "^1.0.0", + "stream-transform": "^0.1.0" + }, + "description": "CSV parser with simple api, full of options and tested against large datasets.", + "devDependencies": {}, + "directories": {}, + "dist": { + "shasum": "d9952d59b1f964a7afbcdd804d6818a73199a477", + "tarball": "https://registry.npmjs.org/csv/-/csv-1.1.1.tgz" + }, + "engines": { + "node": ">= 0.1.90" + }, + "gitHead": "f3520ddeaf087ffb436b3909e447ef3e5fcef316", + "homepage": "http://www.adaltas.com/projects/node-csv/", + "keywords": [ + "node", + "csv", + "tsv", + "parser", + "parse", + "stringifier", + "stringify" + ], + "license": "BSD-3-Clause", + "main": "./lib", + "maintainers": [ + { + "name": "david", + "email": "david@adaltas.com" + } + ], + "name": "csv", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git+https://github.com/wdavidw/node-csv.git" + }, + "scripts": {}, + "version": "1.1.1" +} diff --git a/nobel_winners/node_modules/csv/samples/callback.js b/nobel_winners/node_modules/csv/samples/callback.js new file mode 100644 index 0000000..7bb296b --- /dev/null +++ b/nobel_winners/node_modules/csv/samples/callback.js @@ -0,0 +1,14 @@ + +var csv = require('..'); + +csv.generate({seed: 1, columns: 2, length: 20}, function(err, data){ + csv.parse(data, function(err, data){ + csv.transform(data, function(data){ + return data.map(function(value){return value.toUpperCase()}); + }, function(err, data){ + csv.stringify(data, function(err, data){ + process.stdout.write(data); + }); + }); + }); +}); diff --git a/nobel_winners/node_modules/csv/samples/pipe.js b/nobel_winners/node_modules/csv/samples/pipe.js new file mode 100644 index 0000000..cd3932b --- /dev/null +++ b/nobel_winners/node_modules/csv/samples/pipe.js @@ -0,0 +1,12 @@ + +var csv = require('..'); + +csv.generate({seed: 1, columns: 2, length: 20}) + .pipe(csv.parse()) + .pipe(csv.transform(function(record){ + return record.map(function(value){ + return value.toUpperCase() + }); + })) + .pipe(csv.stringify ()) + .pipe(process.stdout); diff --git a/nobel_winners/node_modules/csv/samples/stream.js b/nobel_winners/node_modules/csv/samples/stream.js new file mode 100644 index 0000000..caf2327 --- /dev/null +++ b/nobel_winners/node_modules/csv/samples/stream.js @@ -0,0 +1,49 @@ + +var csv = require('..'); +var i = 0 + +var generator = csv.generate({seed: 1, columns: 2, length: 20}); +var parser = csv.parse(); +var transformer = csv.transform(function(data){ + i++ + return data.map(function(value){return value.toUpperCase()}); +}); +var stringifier = csv.stringify(); + +generator.on('readable', function(){ + while(data = generator.read()){ + parser.write(data); + } +}); +generator.on('end', function(){ + parser.end() +}); + +parser.on('readable', function(){ + while(data = parser.read()){ + transformer.write(data); + } +}); +parser.on('end', function(){ + transformer.end() +}); + +transformer.on('readable', function(){ + while(data = transformer.read()){ + stringifier.write(data); + } +}); +transformer.on('end', function(){ + stringifier.end(); +}); + +stringifier.on('readable', function(){ + while(data = stringifier.read()){ + process.stdout.write(data); + } +}); +generator.on('end', function(){ + process.stdout.write('=> ' + i + ' records\n'); +}); + + diff --git a/nobel_winners/node_modules/csv/src/index.coffee.md b/nobel_winners/node_modules/csv/src/index.coffee.md new file mode 100644 index 0000000..1029cc5 --- /dev/null +++ b/nobel_winners/node_modules/csv/src/index.coffee.md @@ -0,0 +1,33 @@ + +# CSV + + generate = require 'csv-generate' + parse = require 'csv-parse' + transform = require 'stream-transform' + stringify = require 'csv-stringify' + +## `csv.generate()` + +Reference the CSV generator, alias to `require('csv-generate')`. + + module.exports.generate = generate + +## `csv.parse()` + +Reference the CSV parser, alias to `require('csv-parse')`. + + module.exports.parse = parse + +## `csv.transform()` + +Reference the stream transformer, alias to `require('stream-transform')`. + + module.exports.transform = transform + +## `csv.stringify()` + +Reference the CSV stringifier, alias to `require('csv-stringify')`. + + module.exports.stringify = stringify + + diff --git a/nobel_winners/node_modules/lodash.get/LICENSE b/nobel_winners/node_modules/lodash.get/LICENSE new file mode 100644 index 0000000..e0c69d5 --- /dev/null +++ b/nobel_winners/node_modules/lodash.get/LICENSE @@ -0,0 +1,47 @@ +Copyright jQuery Foundation and other contributors + +Based on Underscore.js, copyright Jeremy Ashkenas, +DocumentCloud and Investigative Reporters & Editors + +This software consists of voluntary contributions made by many +individuals. For exact contribution history, see the revision history +available at https://github.com/lodash/lodash + +The following license applies to all parts of this software except as +documented below: + +==== + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +==== + +Copyright and related rights for sample code are waived via CC0. Sample +code is defined as all source code displayed within the prose of the +documentation. + +CC0: http://creativecommons.org/publicdomain/zero/1.0/ + +==== + +Files located in the node_modules and vendor directories are externally +maintained libraries used by this software which have their own +licenses; we recommend you read them, as their terms may differ from the +terms above. diff --git a/nobel_winners/node_modules/lodash.get/README.md b/nobel_winners/node_modules/lodash.get/README.md new file mode 100644 index 0000000..9079614 --- /dev/null +++ b/nobel_winners/node_modules/lodash.get/README.md @@ -0,0 +1,18 @@ +# lodash.get v4.4.2 + +The [lodash](https://lodash.com/) method `_.get` exported as a [Node.js](https://nodejs.org/) module. + +## Installation + +Using npm: +```bash +$ {sudo -H} npm i -g npm +$ npm i --save lodash.get +``` + +In Node.js: +```js +var get = require('lodash.get'); +``` + +See the [documentation](https://lodash.com/docs#get) or [package source](https://github.com/lodash/lodash/blob/4.4.2-npm-packages/lodash.get) for more details. diff --git a/nobel_winners/node_modules/lodash.get/index.js b/nobel_winners/node_modules/lodash.get/index.js new file mode 100644 index 0000000..0eaadec --- /dev/null +++ b/nobel_winners/node_modules/lodash.get/index.js @@ -0,0 +1,931 @@ +/** + * lodash (Custom Build) + * Build: `lodash modularize exports="npm" -o ./` + * Copyright jQuery Foundation and other contributors + * Released under MIT license + * Based on Underscore.js 1.8.3 + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + */ + +/** Used as the `TypeError` message for "Functions" methods. */ +var FUNC_ERROR_TEXT = 'Expected a function'; + +/** Used to stand-in for `undefined` hash values. */ +var HASH_UNDEFINED = '__lodash_hash_undefined__'; + +/** Used as references for various `Number` constants. */ +var INFINITY = 1 / 0; + +/** `Object#toString` result references. */ +var funcTag = '[object Function]', + genTag = '[object GeneratorFunction]', + symbolTag = '[object Symbol]'; + +/** Used to match property names within property paths. */ +var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, + reIsPlainProp = /^\w*$/, + reLeadingDot = /^\./, + rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g; + +/** + * Used to match `RegExp` + * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). + */ +var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; + +/** Used to match backslashes in property paths. */ +var reEscapeChar = /\\(\\)?/g; + +/** Used to detect host constructors (Safari). */ +var reIsHostCtor = /^\[object .+?Constructor\]$/; + +/** Detect free variable `global` from Node.js. */ +var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; + +/** Detect free variable `self`. */ +var freeSelf = typeof self == 'object' && self && self.Object === Object && self; + +/** Used as a reference to the global object. */ +var root = freeGlobal || freeSelf || Function('return this')(); + +/** + * Gets the value at `key` of `object`. + * + * @private + * @param {Object} [object] The object to query. + * @param {string} key The key of the property to get. + * @returns {*} Returns the property value. + */ +function getValue(object, key) { + return object == null ? undefined : object[key]; +} + +/** + * Checks if `value` is a host object in IE < 9. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a host object, else `false`. + */ +function isHostObject(value) { + // Many host objects are `Object` objects that can coerce to strings + // despite having improperly defined `toString` methods. + var result = false; + if (value != null && typeof value.toString != 'function') { + try { + result = !!(value + ''); + } catch (e) {} + } + return result; +} + +/** Used for built-in method references. */ +var arrayProto = Array.prototype, + funcProto = Function.prototype, + objectProto = Object.prototype; + +/** Used to detect overreaching core-js shims. */ +var coreJsData = root['__core-js_shared__']; + +/** Used to detect methods masquerading as native. */ +var maskSrcKey = (function() { + var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ''); + return uid ? ('Symbol(src)_1.' + uid) : ''; +}()); + +/** Used to resolve the decompiled source of functions. */ +var funcToString = funcProto.toString; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) + * of values. + */ +var objectToString = objectProto.toString; + +/** Used to detect if a method is native. */ +var reIsNative = RegExp('^' + + funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') + .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' +); + +/** Built-in value references. */ +var Symbol = root.Symbol, + splice = arrayProto.splice; + +/* Built-in method references that are verified to be native. */ +var Map = getNative(root, 'Map'), + nativeCreate = getNative(Object, 'create'); + +/** Used to convert symbols to primitives and strings. */ +var symbolProto = Symbol ? Symbol.prototype : undefined, + symbolToString = symbolProto ? symbolProto.toString : undefined; + +/** + * Creates a hash object. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ +function Hash(entries) { + var index = -1, + length = entries ? entries.length : 0; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } +} + +/** + * Removes all key-value entries from the hash. + * + * @private + * @name clear + * @memberOf Hash + */ +function hashClear() { + this.__data__ = nativeCreate ? nativeCreate(null) : {}; +} + +/** + * Removes `key` and its value from the hash. + * + * @private + * @name delete + * @memberOf Hash + * @param {Object} hash The hash to modify. + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ +function hashDelete(key) { + return this.has(key) && delete this.__data__[key]; +} + +/** + * Gets the hash value for `key`. + * + * @private + * @name get + * @memberOf Hash + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ +function hashGet(key) { + var data = this.__data__; + if (nativeCreate) { + var result = data[key]; + return result === HASH_UNDEFINED ? undefined : result; + } + return hasOwnProperty.call(data, key) ? data[key] : undefined; +} + +/** + * Checks if a hash value for `key` exists. + * + * @private + * @name has + * @memberOf Hash + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ +function hashHas(key) { + var data = this.__data__; + return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key); +} + +/** + * Sets the hash `key` to `value`. + * + * @private + * @name set + * @memberOf Hash + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the hash instance. + */ +function hashSet(key, value) { + var data = this.__data__; + data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; + return this; +} + +// Add methods to `Hash`. +Hash.prototype.clear = hashClear; +Hash.prototype['delete'] = hashDelete; +Hash.prototype.get = hashGet; +Hash.prototype.has = hashHas; +Hash.prototype.set = hashSet; + +/** + * Creates an list cache object. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ +function ListCache(entries) { + var index = -1, + length = entries ? entries.length : 0; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } +} + +/** + * Removes all key-value entries from the list cache. + * + * @private + * @name clear + * @memberOf ListCache + */ +function listCacheClear() { + this.__data__ = []; +} + +/** + * Removes `key` and its value from the list cache. + * + * @private + * @name delete + * @memberOf ListCache + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ +function listCacheDelete(key) { + var data = this.__data__, + index = assocIndexOf(data, key); + + if (index < 0) { + return false; + } + var lastIndex = data.length - 1; + if (index == lastIndex) { + data.pop(); + } else { + splice.call(data, index, 1); + } + return true; +} + +/** + * Gets the list cache value for `key`. + * + * @private + * @name get + * @memberOf ListCache + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ +function listCacheGet(key) { + var data = this.__data__, + index = assocIndexOf(data, key); + + return index < 0 ? undefined : data[index][1]; +} + +/** + * Checks if a list cache value for `key` exists. + * + * @private + * @name has + * @memberOf ListCache + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ +function listCacheHas(key) { + return assocIndexOf(this.__data__, key) > -1; +} + +/** + * Sets the list cache `key` to `value`. + * + * @private + * @name set + * @memberOf ListCache + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the list cache instance. + */ +function listCacheSet(key, value) { + var data = this.__data__, + index = assocIndexOf(data, key); + + if (index < 0) { + data.push([key, value]); + } else { + data[index][1] = value; + } + return this; +} + +// Add methods to `ListCache`. +ListCache.prototype.clear = listCacheClear; +ListCache.prototype['delete'] = listCacheDelete; +ListCache.prototype.get = listCacheGet; +ListCache.prototype.has = listCacheHas; +ListCache.prototype.set = listCacheSet; + +/** + * Creates a map cache object to store key-value pairs. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ +function MapCache(entries) { + var index = -1, + length = entries ? entries.length : 0; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } +} + +/** + * Removes all key-value entries from the map. + * + * @private + * @name clear + * @memberOf MapCache + */ +function mapCacheClear() { + this.__data__ = { + 'hash': new Hash, + 'map': new (Map || ListCache), + 'string': new Hash + }; +} + +/** + * Removes `key` and its value from the map. + * + * @private + * @name delete + * @memberOf MapCache + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ +function mapCacheDelete(key) { + return getMapData(this, key)['delete'](key); +} + +/** + * Gets the map value for `key`. + * + * @private + * @name get + * @memberOf MapCache + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ +function mapCacheGet(key) { + return getMapData(this, key).get(key); +} + +/** + * Checks if a map value for `key` exists. + * + * @private + * @name has + * @memberOf MapCache + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ +function mapCacheHas(key) { + return getMapData(this, key).has(key); +} + +/** + * Sets the map `key` to `value`. + * + * @private + * @name set + * @memberOf MapCache + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the map cache instance. + */ +function mapCacheSet(key, value) { + getMapData(this, key).set(key, value); + return this; +} + +// Add methods to `MapCache`. +MapCache.prototype.clear = mapCacheClear; +MapCache.prototype['delete'] = mapCacheDelete; +MapCache.prototype.get = mapCacheGet; +MapCache.prototype.has = mapCacheHas; +MapCache.prototype.set = mapCacheSet; + +/** + * Gets the index at which the `key` is found in `array` of key-value pairs. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} key The key to search for. + * @returns {number} Returns the index of the matched value, else `-1`. + */ +function assocIndexOf(array, key) { + var length = array.length; + while (length--) { + if (eq(array[length][0], key)) { + return length; + } + } + return -1; +} + +/** + * The base implementation of `_.get` without support for default values. + * + * @private + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to get. + * @returns {*} Returns the resolved value. + */ +function baseGet(object, path) { + path = isKey(path, object) ? [path] : castPath(path); + + var index = 0, + length = path.length; + + while (object != null && index < length) { + object = object[toKey(path[index++])]; + } + return (index && index == length) ? object : undefined; +} + +/** + * The base implementation of `_.isNative` without bad shim checks. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a native function, + * else `false`. + */ +function baseIsNative(value) { + if (!isObject(value) || isMasked(value)) { + return false; + } + var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor; + return pattern.test(toSource(value)); +} + +/** + * The base implementation of `_.toString` which doesn't convert nullish + * values to empty strings. + * + * @private + * @param {*} value The value to process. + * @returns {string} Returns the string. + */ +function baseToString(value) { + // Exit early for strings to avoid a performance hit in some environments. + if (typeof value == 'string') { + return value; + } + if (isSymbol(value)) { + return symbolToString ? symbolToString.call(value) : ''; + } + var result = (value + ''); + return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; +} + +/** + * Casts `value` to a path array if it's not one. + * + * @private + * @param {*} value The value to inspect. + * @returns {Array} Returns the cast property path array. + */ +function castPath(value) { + return isArray(value) ? value : stringToPath(value); +} + +/** + * Gets the data for `map`. + * + * @private + * @param {Object} map The map to query. + * @param {string} key The reference key. + * @returns {*} Returns the map data. + */ +function getMapData(map, key) { + var data = map.__data__; + return isKeyable(key) + ? data[typeof key == 'string' ? 'string' : 'hash'] + : data.map; +} + +/** + * Gets the native function at `key` of `object`. + * + * @private + * @param {Object} object The object to query. + * @param {string} key The key of the method to get. + * @returns {*} Returns the function if it's native, else `undefined`. + */ +function getNative(object, key) { + var value = getValue(object, key); + return baseIsNative(value) ? value : undefined; +} + +/** + * Checks if `value` is a property name and not a property path. + * + * @private + * @param {*} value The value to check. + * @param {Object} [object] The object to query keys on. + * @returns {boolean} Returns `true` if `value` is a property name, else `false`. + */ +function isKey(value, object) { + if (isArray(value)) { + return false; + } + var type = typeof value; + if (type == 'number' || type == 'symbol' || type == 'boolean' || + value == null || isSymbol(value)) { + return true; + } + return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || + (object != null && value in Object(object)); +} + +/** + * Checks if `value` is suitable for use as unique object key. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is suitable, else `false`. + */ +function isKeyable(value) { + var type = typeof value; + return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean') + ? (value !== '__proto__') + : (value === null); +} + +/** + * Checks if `func` has its source masked. + * + * @private + * @param {Function} func The function to check. + * @returns {boolean} Returns `true` if `func` is masked, else `false`. + */ +function isMasked(func) { + return !!maskSrcKey && (maskSrcKey in func); +} + +/** + * Converts `string` to a property path array. + * + * @private + * @param {string} string The string to convert. + * @returns {Array} Returns the property path array. + */ +var stringToPath = memoize(function(string) { + string = toString(string); + + var result = []; + if (reLeadingDot.test(string)) { + result.push(''); + } + string.replace(rePropName, function(match, number, quote, string) { + result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); + }); + return result; +}); + +/** + * Converts `value` to a string key if it's not a string or symbol. + * + * @private + * @param {*} value The value to inspect. + * @returns {string|symbol} Returns the key. + */ +function toKey(value) { + if (typeof value == 'string' || isSymbol(value)) { + return value; + } + var result = (value + ''); + return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; +} + +/** + * Converts `func` to its source code. + * + * @private + * @param {Function} func The function to process. + * @returns {string} Returns the source code. + */ +function toSource(func) { + if (func != null) { + try { + return funcToString.call(func); + } catch (e) {} + try { + return (func + ''); + } catch (e) {} + } + return ''; +} + +/** + * Creates a function that memoizes the result of `func`. If `resolver` is + * provided, it determines the cache key for storing the result based on the + * arguments provided to the memoized function. By default, the first argument + * provided to the memoized function is used as the map cache key. The `func` + * is invoked with the `this` binding of the memoized function. + * + * **Note:** The cache is exposed as the `cache` property on the memoized + * function. Its creation may be customized by replacing the `_.memoize.Cache` + * constructor with one whose instances implement the + * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object) + * method interface of `delete`, `get`, `has`, and `set`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Function + * @param {Function} func The function to have its output memoized. + * @param {Function} [resolver] The function to resolve the cache key. + * @returns {Function} Returns the new memoized function. + * @example + * + * var object = { 'a': 1, 'b': 2 }; + * var other = { 'c': 3, 'd': 4 }; + * + * var values = _.memoize(_.values); + * values(object); + * // => [1, 2] + * + * values(other); + * // => [3, 4] + * + * object.a = 2; + * values(object); + * // => [1, 2] + * + * // Modify the result cache. + * values.cache.set(object, ['a', 'b']); + * values(object); + * // => ['a', 'b'] + * + * // Replace `_.memoize.Cache`. + * _.memoize.Cache = WeakMap; + */ +function memoize(func, resolver) { + if (typeof func != 'function' || (resolver && typeof resolver != 'function')) { + throw new TypeError(FUNC_ERROR_TEXT); + } + var memoized = function() { + var args = arguments, + key = resolver ? resolver.apply(this, args) : args[0], + cache = memoized.cache; + + if (cache.has(key)) { + return cache.get(key); + } + var result = func.apply(this, args); + memoized.cache = cache.set(key, result); + return result; + }; + memoized.cache = new (memoize.Cache || MapCache); + return memoized; +} + +// Assign cache to `_.memoize`. +memoize.Cache = MapCache; + +/** + * Performs a + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * comparison between two values to determine if they are equivalent. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'a': 1 }; + * var other = { 'a': 1 }; + * + * _.eq(object, object); + * // => true + * + * _.eq(object, other); + * // => false + * + * _.eq('a', 'a'); + * // => true + * + * _.eq('a', Object('a')); + * // => false + * + * _.eq(NaN, NaN); + * // => true + */ +function eq(value, other) { + return value === other || (value !== value && other !== other); +} + +/** + * Checks if `value` is classified as an `Array` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array, else `false`. + * @example + * + * _.isArray([1, 2, 3]); + * // => true + * + * _.isArray(document.body.children); + * // => false + * + * _.isArray('abc'); + * // => false + * + * _.isArray(_.noop); + * // => false + */ +var isArray = Array.isArray; + +/** + * Checks if `value` is classified as a `Function` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a function, else `false`. + * @example + * + * _.isFunction(_); + * // => true + * + * _.isFunction(/abc/); + * // => false + */ +function isFunction(value) { + // The use of `Object#toString` avoids issues with the `typeof` operator + // in Safari 8-9 which returns 'object' for typed array and other constructors. + var tag = isObject(value) ? objectToString.call(value) : ''; + return tag == funcTag || tag == genTag; +} + +/** + * Checks if `value` is the + * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) + * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(_.noop); + * // => true + * + * _.isObject(null); + * // => false + */ +function isObject(value) { + var type = typeof value; + return !!value && (type == 'object' || type == 'function'); +} + +/** + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + * @example + * + * _.isObjectLike({}); + * // => true + * + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); + * // => false + */ +function isObjectLike(value) { + return !!value && typeof value == 'object'; +} + +/** + * Checks if `value` is classified as a `Symbol` primitive or object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. + * @example + * + * _.isSymbol(Symbol.iterator); + * // => true + * + * _.isSymbol('abc'); + * // => false + */ +function isSymbol(value) { + return typeof value == 'symbol' || + (isObjectLike(value) && objectToString.call(value) == symbolTag); +} + +/** + * Converts `value` to a string. An empty string is returned for `null` + * and `undefined` values. The sign of `-0` is preserved. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to process. + * @returns {string} Returns the string. + * @example + * + * _.toString(null); + * // => '' + * + * _.toString(-0); + * // => '-0' + * + * _.toString([1, 2, 3]); + * // => '1,2,3' + */ +function toString(value) { + return value == null ? '' : baseToString(value); +} + +/** + * Gets the value at `path` of `object`. If the resolved value is + * `undefined`, the `defaultValue` is returned in its place. + * + * @static + * @memberOf _ + * @since 3.7.0 + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to get. + * @param {*} [defaultValue] The value returned for `undefined` resolved values. + * @returns {*} Returns the resolved value. + * @example + * + * var object = { 'a': [{ 'b': { 'c': 3 } }] }; + * + * _.get(object, 'a[0].b.c'); + * // => 3 + * + * _.get(object, ['a', '0', 'b', 'c']); + * // => 3 + * + * _.get(object, 'a.b.c', 'default'); + * // => 'default' + */ +function get(object, path, defaultValue) { + var result = object == null ? undefined : baseGet(object, path); + return result === undefined ? defaultValue : result; +} + +module.exports = get; diff --git a/nobel_winners/node_modules/lodash.get/package.json b/nobel_winners/node_modules/lodash.get/package.json new file mode 100644 index 0000000..54cb4b1 --- /dev/null +++ b/nobel_winners/node_modules/lodash.get/package.json @@ -0,0 +1,113 @@ +{ + "_args": [ + [ + { + "raw": "lodash.get@^4.0.0", + "scope": null, + "escapedName": "lodash.get", + "name": "lodash.get", + "rawSpec": "^4.0.0", + "spec": ">=4.0.0 <5.0.0", + "type": "range" + }, + "/Users/heatherdesigns/gemcityjs/collaborative-may/nobel_winners/node_modules/csv-stringify" + ] + ], + "_from": "lodash.get@>=4.0.0 <5.0.0", + "_id": "lodash.get@4.4.2", + "_inCache": true, + "_location": "/lodash.get", + "_nodeVersion": "4.4.7", + "_npmOperationalInternal": { + "host": "packages-16-east.internal.npmjs.com", + "tmp": "tmp/lodash.get-4.4.2.tgz_1471109964075_0.3515763762407005" + }, + "_npmUser": { + "name": "jdalton", + "email": "john.david.dalton@gmail.com" + }, + "_npmVersion": "2.15.10", + "_phantomChildren": {}, + "_requested": { + "raw": "lodash.get@^4.0.0", + "scope": null, + "escapedName": "lodash.get", + "name": "lodash.get", + "rawSpec": "^4.0.0", + "spec": ">=4.0.0 <5.0.0", + "type": "range" + }, + "_requiredBy": [ + "/csv-stringify" + ], + "_resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", + "_shasum": "2d177f652fa31e939b4438d5341499dfa3825e99", + "_shrinkwrap": null, + "_spec": "lodash.get@^4.0.0", + "_where": "/Users/heatherdesigns/gemcityjs/collaborative-may/nobel_winners/node_modules/csv-stringify", + "author": { + "name": "John-David Dalton", + "email": "john.david.dalton@gmail.com", + "url": "http://allyoucanleet.com/" + }, + "bugs": { + "url": "https://github.com/lodash/lodash/issues" + }, + "contributors": [ + { + "name": "John-David Dalton", + "email": "john.david.dalton@gmail.com", + "url": "http://allyoucanleet.com/" + }, + { + "name": "Blaine Bublitz", + "email": "blaine.bublitz@gmail.com", + "url": "https://github.com/phated" + }, + { + "name": "Mathias Bynens", + "email": "mathias@qiwi.be", + "url": "https://mathiasbynens.be/" + } + ], + "dependencies": {}, + "description": "The lodash method `_.get` exported as a module.", + "devDependencies": {}, + "directories": {}, + "dist": { + "shasum": "2d177f652fa31e939b4438d5341499dfa3825e99", + "tarball": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz" + }, + "homepage": "https://lodash.com/", + "icon": "https://lodash.com/icon.svg", + "keywords": [ + "lodash-modularized", + "get" + ], + "license": "MIT", + "maintainers": [ + { + "name": "jdalton", + "email": "john.david.dalton@gmail.com" + }, + { + "name": "mathias", + "email": "mathias@qiwi.be" + }, + { + "name": "phated", + "email": "blaine@iceddev.com" + } + ], + "name": "lodash.get", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git+https://github.com/lodash/lodash.git" + }, + "scripts": { + "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" + }, + "version": "4.4.2" +} diff --git a/nobel_winners/node_modules/stream-transform/.npmignore b/nobel_winners/node_modules/stream-transform/.npmignore new file mode 100644 index 0000000..4c9bd0a --- /dev/null +++ b/nobel_winners/node_modules/stream-transform/.npmignore @@ -0,0 +1,4 @@ +/src +/test +/Makefile +.travis.yml \ No newline at end of file diff --git a/nobel_winners/node_modules/stream-transform/LICENSE b/nobel_winners/node_modules/stream-transform/LICENSE new file mode 100644 index 0000000..f77b58e --- /dev/null +++ b/nobel_winners/node_modules/stream-transform/LICENSE @@ -0,0 +1,16 @@ +Software License Agreement (BSD License) +======================================== + +Copyright (c) 2011, SARL Adaltas. + +All rights reserved. + +Redistribution and use of this software in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +- Neither the name of SARL Adaltas nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission of the SARL Adaltas. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/nobel_winners/node_modules/stream-transform/README.md b/nobel_winners/node_modules/stream-transform/README.md new file mode 100644 index 0000000..36543a7 --- /dev/null +++ b/nobel_winners/node_modules/stream-transform/README.md @@ -0,0 +1,64 @@ +[![Build Status](https://secure.travis-ci.org/wdavidw/node-csv-parse.png)][travis] + +Part of the [CSV module][csv_home], this project is a simple object +transformation framework. It implements the Node.js [`stream.Transform` API][streamtransform]. +It also provides a simple callback-based API for convenience. +It is both extremely easy to use and powerful. + +[Documentation for the "csv-parse" package is available here][home]. + +## Features + +* Follow the Node.js [streaming API][streamtransform] +* Simplicity with the optional callback API +* Synchronous and asynchronous user handler functions +* Accepts arrays of strings, or arrays of objects as input +* Sequential or user-defined concurrent execution +* Skip and create new records +* Alter or clone input data +* BSD License + +Usage +----- + +Refer to the [project webpage][home] for [an exhaustive list of options][home] +and [some usage examples][examples]. + +The module is built on the Node.js Stream API. For the sake of simplify, a +simple callback API is also provided. To give you a quick look, here's an +example of the callback API: + +```javascript +var transform = require('stream-transform'); + +input = [ [ '1', '2', '3', '4' ], [ 'a', 'b', 'c', 'd' ] ]; +transform(input, function(data){ + data.push(data.shift()); + return data.join(',')+'\n'; +}, function(err, output){ + output.should.eql([ '2,3,4,1\n', 'b,c,d,a\n' ]); +}); +``` + +Development +----------- + +Tests are executed with mocha. To install it, simple run `npm install` +followed by `npm test`. It will install mocha and its dependencies in your +project "node_modules" directory and run the test suite. The tests run +against the CoffeeScript source files. + +To generate the JavaScript files, run `npm run coffee`. + +The test suite is run online with [Travis][travis] against the versions +0.10, 0.11 and 0.12 of Node.js. + + +[streamtransform]: http://nodejs.org/api/stream.html#stream_class_stream_transform +[home]: http://csv.adaltas.com/transform/ +[examples]: http://csv.adaltas.com/transform/examples/ +[csv_home]: https://github.com/wdavidw/node-csv +[stream-samples]: https://github.com/wdavidw/node-stream-transform/tree/master/samples +[stream-test]: https://github.com/wdavidw/node-stream-transform/tree/master/test +[travis]: http://travis-ci.org/wdavidw/node-stream-transform + diff --git a/nobel_winners/node_modules/stream-transform/lib/index.js b/nobel_winners/node_modules/stream-transform/lib/index.js new file mode 100644 index 0000000..92176f8 --- /dev/null +++ b/nobel_winners/node_modules/stream-transform/lib/index.js @@ -0,0 +1,171 @@ +// Generated by CoffeeScript 1.9.2 +var Transformer, stream, util, + slice = [].slice; + +stream = require('stream'); + +util = require('util'); + +module.exports = function() { + var argument, callback, data, error, handler, i, j, k, len, options, result, transform, type, v; + options = {}; + for (i = j = 0, len = arguments.length; j < len; i = ++j) { + argument = arguments[i]; + type = typeof argument; + if (argument === null) { + type = 'null'; + } else if (type === 'object' && Array.isArray(argument)) { + type = 'array'; + } + if (i === 0) { + if (type === 'function') { + handler = argument; + } else if (type !== null) { + data = argument; + } + continue; + } + if (type === 'object') { + for (k in argument) { + v = argument[k]; + options[k] = v; + } + } else if (type === 'function') { + if (handler && i === arguments.length - 1) { + callback = argument; + } else { + handler = argument; + } + } else if (type !== 'null') { + throw new Error('Invalid arguments'); + } + } + transform = new Transformer(options, handler); + error = false; + if (data) { + process.nextTick(function() { + var len1, m, row; + for (m = 0, len1 = data.length; m < len1; m++) { + row = data[m]; + if (error) { + break; + } + transform.write(row); + } + return transform.end(); + }); + } + if (callback || options.consume) { + result = []; + transform.on('readable', function() { + var r, results; + results = []; + while ((r = transform.read())) { + if (callback) { + results.push(result.push(r)); + } else { + results.push(void 0); + } + } + return results; + }); + transform.on('error', function(err) { + error = true; + if (callback) { + return callback(err); + } + }); + transform.on('end', function() { + if (callback && !error) { + return callback(null, result); + } + }); + } + return transform; +}; + +Transformer = function(options1, transform1) { + var base; + this.options = options1 != null ? options1 : {}; + this.transform = transform1; + this.options.objectMode = true; + if ((base = this.options).parallel == null) { + base.parallel = 100; + } + stream.Transform.call(this, this.options); + this.running = 0; + this.started = 0; + this.finished = 0; + return this; +}; + +util.inherits(Transformer, stream.Transform); + +module.exports.Transformer = Transformer; + +Transformer.prototype._transform = function(chunk, encoding, cb) { + var callback, err, l; + this.started++; + this.running++; + if (this.running < this.options.parallel) { + cb(); + cb = null; + } + try { + l = this.transform.length; + if (this.options.params != null) { + l--; + } + if (l === 1) { + this._done(null, [this.transform.call(null, chunk, this.options.params)], cb); + } else if (l === 2) { + callback = (function(_this) { + return function() { + var chunks, err; + err = arguments[0], chunks = 2 <= arguments.length ? slice.call(arguments, 1) : []; + return _this._done(err, chunks, cb); + }; + })(this); + this.transform.call(null, chunk, callback, this.options.params); + } else { + throw Error("Invalid handler arguments"); + } + return false; + } catch (_error) { + err = _error; + return this._done(err); + } +}; + +Transformer.prototype._flush = function(cb) { + this._ending = function() { + if (this.running === 0) { + return cb(); + } + }; + return this._ending(); +}; + +Transformer.prototype._done = function(err, chunks, cb) { + var chunk, j, len; + this.running--; + if (err) { + return this.emit('error', err); + } + this.finished++; + for (j = 0, len = chunks.length; j < len; j++) { + chunk = chunks[j]; + if (typeof chunk === 'number') { + chunk = "" + chunk; + } + if (chunk != null) { + this.push(chunk); + } + } + if (cb) { + cb(); + } + if (this._ending) { + return this._ending(); + } +}; diff --git a/nobel_winners/node_modules/stream-transform/package.json b/nobel_winners/node_modules/stream-transform/package.json new file mode 100644 index 0000000..5a51319 --- /dev/null +++ b/nobel_winners/node_modules/stream-transform/package.json @@ -0,0 +1,91 @@ +{ + "_args": [ + [ + { + "raw": "stream-transform@^0.1.0", + "scope": null, + "escapedName": "stream-transform", + "name": "stream-transform", + "rawSpec": "^0.1.0", + "spec": ">=0.1.0 <0.2.0", + "type": "range" + }, + "/Users/heatherdesigns/gemcityjs/collaborative-may/nobel_winners/node_modules/csv" + ] + ], + "_from": "stream-transform@>=0.1.0 <0.2.0", + "_id": "stream-transform@0.1.2", + "_inCache": true, + "_location": "/stream-transform", + "_nodeVersion": "6.7.0", + "_npmOperationalInternal": { + "host": "packages-12-west.internal.npmjs.com", + "tmp": "tmp/stream-transform-0.1.2.tgz_1486502394964_0.11159795918501914" + }, + "_npmUser": { + "name": "david", + "email": "david@adaltas.com" + }, + "_npmVersion": "3.10.3", + "_phantomChildren": {}, + "_requested": { + "raw": "stream-transform@^0.1.0", + "scope": null, + "escapedName": "stream-transform", + "name": "stream-transform", + "rawSpec": "^0.1.0", + "spec": ">=0.1.0 <0.2.0", + "type": "range" + }, + "_requiredBy": [ + "/csv" + ], + "_resolved": "https://registry.npmjs.org/stream-transform/-/stream-transform-0.1.2.tgz", + "_shasum": "7d8e6b4e03ac4781778f8c79517501bfb0762a9f", + "_shrinkwrap": null, + "_spec": "stream-transform@^0.1.0", + "_where": "/Users/heatherdesigns/gemcityjs/collaborative-may/nobel_winners/node_modules/csv", + "dependencies": {}, + "description": "Object transformations implementing the Node.js `stream.Transform` API", + "devDependencies": { + "coffee-script": "latest", + "csv-generate": "latest", + "mocha": "latest", + "pad": "latest", + "should": "latest" + }, + "directories": {}, + "dist": { + "shasum": "7d8e6b4e03ac4781778f8c79517501bfb0762a9f", + "tarball": "https://registry.npmjs.org/stream-transform/-/stream-transform-0.1.2.tgz" + }, + "gitHead": "71b6e35390b5880c25ccee0b01b2509e627b177d", + "homepage": "http://csv.adaltas.com/transform/", + "keywords": [ + "stream", + "transform", + "csv", + "object" + ], + "license": "BSD-3-Clause", + "main": "./lib", + "maintainers": [ + { + "name": "david", + "email": "david@adaltas.com" + } + ], + "name": "stream-transform", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "http://www.github.com/wdavidw/node-stream-transform" + }, + "scripts": { + "coffee": "coffee -b -o lib src", + "pretest": "coffee -b -o lib src", + "test": "NODE_ENV=test ./node_modules/.bin/mocha --compilers coffee:coffee-script/register --reporter dot" + }, + "version": "0.1.2" +} diff --git a/nobel_winners/node_modules/stream-transform/samples/asynchronous.js b/nobel_winners/node_modules/stream-transform/samples/asynchronous.js new file mode 100644 index 0000000..a65d194 --- /dev/null +++ b/nobel_winners/node_modules/stream-transform/samples/asynchronous.js @@ -0,0 +1,17 @@ + +var transform = require('..'); + +transform([ + ['1','2','3','4'], + ['a','b','c','d'] +], function(data, callback){ + setImmediate(function(){ + data.push(data.shift()); + callback(null, data.join(',')+'\n'); + }); +}, {parallel: 20}) +.pipe(process.stdout); + +// Output: +// 2,3,4,1 +// b,c,d,a diff --git a/nobel_winners/node_modules/stream-transform/samples/callback.js b/nobel_winners/node_modules/stream-transform/samples/callback.js new file mode 100644 index 0000000..32db1e9 --- /dev/null +++ b/nobel_winners/node_modules/stream-transform/samples/callback.js @@ -0,0 +1,13 @@ + +var transform = require('..'); +var should = require('should'); + +transform([ + ['1','2','3','4'], + ['a','b','c','d'] +], function(data){ + data.push(data.shift()) + return data; +}, function(err, output){ + output.should.eql([ [ '2', '3', '4', '1' ], [ 'b', 'c', 'd', 'a' ] ]); +}); diff --git a/nobel_winners/node_modules/stream-transform/samples/stream.js b/nobel_winners/node_modules/stream-transform/samples/stream.js new file mode 100644 index 0000000..a9282a9 --- /dev/null +++ b/nobel_winners/node_modules/stream-transform/samples/stream.js @@ -0,0 +1,23 @@ + +var transform = require('..'); +var should = require('should'); + +var output = []; +var transformer = transform(function(data){ + data.push(data.shift()) + return data; +}); +transformer.on('readable', function(){ + while(row = transformer.read()){ + output.push(row); + } +}); +transformer.on('error', function(err){ + console.log(err.message); +}); +transformer.on('finish', function(){ + output.should.eql([ [ '2', '3', '4', '1' ], [ 'b', 'c', 'd', 'a' ] ]); +}); +transformer.write(['1','2','3','4']); +transformer.write(['a','b','c','d']); +transformer.end(); diff --git a/nobel_winners/node_modules/stream-transform/samples/synchronous.js b/nobel_winners/node_modules/stream-transform/samples/synchronous.js new file mode 100644 index 0000000..1c3caf7 --- /dev/null +++ b/nobel_winners/node_modules/stream-transform/samples/synchronous.js @@ -0,0 +1,15 @@ + +var transform = require('..'); + +transform([ + ['1','2','3','4'], + ['a','b','c','d'] +], function(data){ + data.push(data.shift()); + return data.join(',')+'\n'; +}) +.pipe(process.stdout); + +// Output: +// 2,3,4,1 +// b,c,d,a diff --git a/nobel_winners/package.json b/nobel_winners/package.json new file mode 100644 index 0000000..55eb362 --- /dev/null +++ b/nobel_winners/package.json @@ -0,0 +1,17 @@ +{ + "name": "nobel_winners", + "version": "1.0.0", + "description": "", + "main": "app.js", + "dependencies": { + "csv": "^1.1.1", + "csv-parse": "^1.2.0", + "csv-to-json": "^0.1.2" + }, + "devDependencies": {}, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "", + "license": "ISC" +}