Conversation
changed dir name
added files to empty dirs
created file reader module
duplicated file
colors are changing
transform module
included linter and test structure
working with image transforms
refactored writer module
cli commands work
more CLI work
README and greyscale command
removing comments
reader/writer test done
added redscale greenscale bluescale functionality
tests finally working
linter changes and minor updates
fixed transforms
expect(err).toBe(null);
expect(typeof data).toBe('data');
}.bmp
Taylor test
|
|
||
| ## Transform Methods | ||
| * **blkToWhite** - All black values are changed to white. | ||
| * **toLateEighties** - Changes the original bitmap to a rad combination of teals, pink, and purple. |
There was a problem hiding this comment.
I dig this transform -- it's creative and unique!
| const writer = require('./lib/bitmap-writer.js'); | ||
| const transform = require('./lib/transform.js'); | ||
|
|
||
| process.argv.forEach((val, idx) => { |
There was a problem hiding this comment.
This function doesn't seem to do anything -- worth excising
| let bm = fs.readFileSync(`${__dirname}/../data/palette-bitmap.bmp`); | ||
| // console.log('data in test:', bm); | ||
| let bitMap = constructor(bm); | ||
| // console.log('bitmap obj in test:', bitMap); |
There was a problem hiding this comment.
Corpse code wants to be deleted, not left commented out
| @@ -0,0 +1,16 @@ | |||
| 'use strict'; | |||
|
|
|||
| const constructor = module.exports = function(data, err) { | |||
There was a problem hiding this comment.
Where did these numbers come from? I know, but would someone else looking at this know? Will you know when you look at this in a year? Store magic numbers such as these into a meaningfully named variable so that you can easily look and know what they represent.
| 'use strict'; | ||
|
|
||
| const constructor = module.exports = function(data, err) { | ||
| if(err) return err; |
There was a problem hiding this comment.
This isn't really an error-first function. Export the constructor directly and then use it to instantiate new objects directly where you need them.
| let newBitMap = constructor(data); | ||
| console.log('transform method passed through:',transformMethod); | ||
|
|
||
| if (transformMethod === 'blkToWhite') { |
There was a problem hiding this comment.
Is there a programmatic way you could handle this so you don't need so much repeated code? Take a look at Object.keys() for some inspiration.
| data.pixels[i * 2] = 1; | ||
| data.pixels[i * 3] = 0; | ||
| } | ||
| for (let i = 2500; i > 0; i--) { |
| }; | ||
|
|
||
| exports.solid = function(data, err) { | ||
| // for(let i = 0; i < data.pixels.length/2; i++) { |
| @@ -0,0 +1,114 @@ | |||
| 'use strict'; | |||
There was a problem hiding this comment.
Seems like there is a handful of repetition in these functions. Most rely on the same looping construct. Is there a way to capture that functionality for reuse rather than retyping it each time?
No description provided.