-
Notifications
You must be signed in to change notification settings - Fork 15
completed day 3 lab #9
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
base: master
Are you sure you want to change the base?
Conversation
"indent": [ "error", 2 ], | ||
"quotes": [ "error", "single" ], | ||
"semi": ["error", "always"], | ||
"linebreak-style": [ "error", "unix" ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No comma dangle. :p Boo
@@ -0,0 +1,117 @@ | |||
# Created by https://www.gitignore.io/api/node,vim,osx,macos,linux | |||
|
|||
*node_modules |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work ignoring node modules
@@ -0,0 +1 @@ | |||
Brian is a pretty cool teacher |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sure he would appreciate this text file.
@@ -0,0 +1 @@ | |||
Hopefully I get this right |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems right to me!
@@ -0,0 +1 @@ | |||
Too bad he makes me text this in order |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, what a jerk. :p
fs.readFile(file1, function(err, data){ | ||
if(err) return callback(err); | ||
var eightHexes = data.toString('hex') | ||
.match(/.{1,2}/g) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice regex. :)
if(err) return callback(err); | ||
var eightHexes = data.toString('hex') | ||
.match(/.{1,2}/g) | ||
.filter(function(ele, index){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice use of a higher order array method.
}).join(''); | ||
resArr.push(eightHexes); | ||
console.log(eightHexes); | ||
return callback(null, resArr); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice use of the callback here, though I don't see you calling it in your initial function call in your other page?
describe('File Reader Module', function(){ | ||
describe('with an improper set of filepaths', function(){ | ||
it('should return an error', function(done){ | ||
fileReader('bad/path1', 'bad/path2', 'bad/path3', function(err){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work with the bad file paths for the test. The test should fail and throw an error immediately when it hits the first bad file, though.
it('should return all of the correct data', function(done){ | ||
fileReader(`${__dirname}/../data/one.txt`, `${__dirname}/../data/two.txt`, `${__dirname}/../data/three.txt`, function(err, data){ | ||
expect(data.length).to.equal(3); | ||
expect(data[0]).to.equal('427269616e206973'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great test. Nice work checking the actual returned hex values, as well as the length of the data array being returned.
No description provided.