Skip to content

Bitmap Transformer#17

Open
goodbye-internet wants to merge 28 commits intocodefellows-seattle-javascript-401d12:masterfrom
goodbye-internet:bitmap
Open

Bitmap Transformer#17
goodbye-internet wants to merge 28 commits intocodefellows-seattle-javascript-401d12:masterfrom
goodbye-internet:bitmap

Conversation

@goodbye-internet
Copy link
Copy Markdown

@goodbye-internet goodbye-internet commented Dec 12, 2016

This is a bitmap transformer.

jonathanheemstra and others added 28 commits December 8, 2016 17:25
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
Abstracted helper file. removed transforms file. Index is now entry p…
added swtich statements to accept CLI flags for transforms
Copy link
Copy Markdown
Contributor

@bnates bnates left a comment

Choose a reason for hiding this comment

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

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`.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@brittdawn @jonathanheemstra @peterkim2 README.md looks good!


gulp.task('clear', function (done) {
return cache.clearAll(done);
});
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@brittdawn @jonathanheemstra @peterkim2 gulpfile.js looks good - nice job including a clear task


module.exports = exports = {};

switch (process.argv[2]) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@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');
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

};

exports.filePath = `${__dirname}/../assets/palette-bitmap.bmp`;
exports.filePath2 = `${__dirname}/../assets/astro.bmp`;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@brittdawn @jonathanheemstra @peterkim2 bitmap-file-helper module looks good


exports.BufferData.prototype.black = function() {
this.colorArray.fill(0);
};
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@brittdawn @jonathanheemstra @peterkim2 transform methods look great! Nice job adding the luminosity, invert, and greyscale transforms

"mocha": "^3.2.0"
},
"scripts": {
"test": "mocha"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@brittdawn @jonathanheemstra @peterkim2 nice job adding a basic npm "test" script

});
});
describe('Transform methods', function() {
before('Build bitmap object', function() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@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() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@brittdawn @jonathanheemstra @peterkim2 great tests to check the hex color values of your color array

});
});
});
});
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@brittdawn @jonathanheemstra @peterkim2 readFileHelper tests look good!

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.

4 participants