Bitmap Transformer#17
Bitmap Transformer#17goodbye-internet wants to merge 28 commits intocodefellows-seattle-javascript-401d12:masterfrom goodbye-internet:bitmap
Conversation
bitmap intial project scaffold
build bitmap constructor
build out constructor, returning buffer data
updated the object constructor and associated funcitons to accept three arguments: file, callback, and convert. This will allow us to pass a conversion flag to our calls on index.js file
Object constructor build
Abstracted helper file. removed transforms file. Index is now entry p…
set up two simple tests
added swtich statements to accept CLI flags for transforms
bnates
left a comment
There was a problem hiding this comment.
Excellent job on this project - it's clear that you kept modularity in mind and, outside of the initial switch statement in your index file, i didn't find any anti-patterns or real nitpicks
| --- | ||
| ## To Run Tests: | ||
|
|
||
| You can type the following into the command line: `gulp test`. |
There was a problem hiding this comment.
@brittdawn @jonathanheemstra @peterkim2 README.md looks good!
|
|
||
| gulp.task('clear', function (done) { | ||
| return cache.clearAll(done); | ||
| }); |
There was a problem hiding this comment.
@brittdawn @jonathanheemstra @peterkim2 gulpfile.js looks good - nice job including a clear task
|
|
||
| module.exports = exports = {}; | ||
|
|
||
| switch (process.argv[2]) { |
There was a problem hiding this comment.
@brittdawn @jonathanheemstra @peterkim2 generally speaking, it's bad practice to use switch statements but this seems like an interesting use case for one - that said, the following code could be refactored to be more dynamic and with way fewer lines of code - you could just grab the command line argument and pass that as the final parameter of your readFileHelper
| readFileHelper.bitmap(readFileHelper.filePath, readFileHelper.callback, 'black'); | ||
| break; | ||
| default: | ||
| console.log('Please enter one of the following: green, white, invert, greyscale, luminosity, black or all'); |
There was a problem hiding this comment.
@brittdawn @jonathanheemstra @peterkim2 good UX catch
| }; | ||
|
|
||
| exports.filePath = `${__dirname}/../assets/palette-bitmap.bmp`; | ||
| exports.filePath2 = `${__dirname}/../assets/astro.bmp`; |
There was a problem hiding this comment.
@brittdawn @jonathanheemstra @peterkim2 bitmap-file-helper module looks good
|
|
||
| exports.BufferData.prototype.black = function() { | ||
| this.colorArray.fill(0); | ||
| }; |
There was a problem hiding this comment.
@brittdawn @jonathanheemstra @peterkim2 transform methods look great! Nice job adding the luminosity, invert, and greyscale transforms
| "mocha": "^3.2.0" | ||
| }, | ||
| "scripts": { | ||
| "test": "mocha" |
There was a problem hiding this comment.
@brittdawn @jonathanheemstra @peterkim2 nice job adding a basic npm "test" script
| }); | ||
| }); | ||
| describe('Transform methods', function() { | ||
| before('Build bitmap object', function() { |
There was a problem hiding this comment.
@brittdawn @jonathanheemstra @peterkim2 great use of the before hook to create new bitmap data
| it('should have white colorArray with members equal to #FFFFFF', function() { | ||
| expect(this.whiteObj.colorArray.slice(0,4)).to.be.deep.equal(Buffer.from([0xff,0xff,0xff,0xff])); | ||
| }); | ||
| it('should have black colorArray with members equal to #000000', function() { |
There was a problem hiding this comment.
@brittdawn @jonathanheemstra @peterkim2 great tests to check the hex color values of your color array
| }); | ||
| }); | ||
| }); | ||
| }); |
There was a problem hiding this comment.
@brittdawn @jonathanheemstra @peterkim2 readFileHelper tests look good!
This is a bitmap transformer.