1.0.3 • Published 6 years ago

parsebyalgorithm v1.0.3

Weekly downloads
3
License
ISC
Repository
github
Last release
6 years ago

ParseByAlgorithm

ParseByAlgorithm is a small application that parser a csv file according to the algorithm(function) you set.

Code sample:

const Parser = require('parsebyalgorithm');
const stream = require('stream');
const readline = require('readline');
const fs = require('fs');

let algorithm = (data) => {
  // manipulate data the way you want here,
  // just keep in mind that you will be reading
  // one line per "iteration" as the Parser uses nodejs readline module

  return data.reverse();  
}

const parser = new Parser(stream, readline);
parser.setParseAlgorithm(algorithm);

const buffer = fs.readFileSync('path_to_a_file');

const resolvingData = parser.exec(buffer);
resolvingData
    .then(parsedData => console.log(parsedData))
    .catch(err => console.error(err));

Testing

  npm test

Example

  npm run example 
1.0.3

6 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago