Code Monkey home page Code Monkey logo

csv-parser's Introduction

Cap Table Utility

This is a utility that takes in a CSV file with investor information and aggregates it into a JSON object that is representative of a Cap Table.

Assumptions

  • CSV is comma delimited columns and new line for delimiting rows

  • CSV contains all headers listed in the example and they are the following strings:

    #INVESTMENT DATE, SHARES PURCHASED, CASH PAID, INVESTOR

  • Desired output is to standard output

  • Testing/Grading will occur on a Mac/Linux based system. This was developed on a Mac and due to the differences between line returns on the Mac/Windows Platforms (e.g. vs. + ), this program may behave differently on a windows based system

Dependencies

Mocha 6.2.0 NPM 5.6.0 Node v8.9.4

Installation

You'll need to get node for mac if it's not already installed. You can find the relevant binaries here:

https://nodejs.org/en/download/

after that install mocha globally with npm install -g mocha (if needed)

Usage

Use command line arguments to invoke the method:

node index <path_to_test_file> YYYY-MM-DD

will invoke the script. The date is optional and the program will use the current date if a date is omitted or formatted incorrectly.

Test Files

A test file exist in the test directory. test_file1.txt is a replica of the homework assignment input.

Run

To run against the homework assignment input enter node index.js ./test/test_file1.txt

Testing

To run unit tests run npm test

Note: you may need to install Mocha, but it should run using the local installation provided with the node modules

Design concepts

Generally, speaking one of the larger challenges I've observed with coding is maintenance. In this case, there were possibly more efficient ways to write the code and it could have been less verbose, but I opted to error on the side of explicit and longer variable names and more of them to make it clear what's happening as opposed to minimizing the actual number of lines or algorithm optimization. Hence, components are generally broken down into the smallest unit of functionality and then imported into the index file and run systematically.

I have a preference for not altering global objects, so while it incurs a larger memory cost, the thought is from a functional programming mindset that it's wiser to pass--for example--an array into a function, clone the objects within the array and push them on to a new array, then return the new array where this is practical. Even those this incurs extra compute and memory cost it prevents state problems when programs get larger.

csv-parser's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.