Skip to content

Zachary Crumbo Assignment 3 #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

zcrumbo
Copy link

@zcrumbo zcrumbo commented Feb 16, 2017

No description provided.


fs.readFile(`${__dirname}/../data/${file1}`, function(err,data){
if (err) return callback(err);

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably don't need this white space here.



module.exports = function(file1, file2, file3, callback){

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is set up well. I like that you are passing in your file names as parameters.

module.exports = function(file1, file2, file3, callback){

fs.readFile(`${__dirname}/../data/${file1}`, function(err,data){
if (err) return callback(err);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job returning your error with the callback.

if (err) return callback(err);
var third = data.toString('hex').substring(0,8);
resultsArray.push(third);
return callback(null, resultsArray);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job pushing your data into an array and passing back the array at the end. This takes care of the asynchronous nature of the file reads.

expect(data[0]).to.equal(testData[0]);
expect(data[1]).to.equal(testData[1]);
expect(data[2]).to.equal(testData[2]);
done();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job here. This verify's that they are in the correct order.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants