pushing - #7
pushing#7brianbixby wants to merge 1 commit into
Conversation
|
|
||
| fs.readFile(`${__dirname}/../assets/${filePath}`, function(err, data) { | ||
| if (err) return rfCallback(err); | ||
| // console.log(data.toString('hex')); |
There was a problem hiding this comment.
Corpse code wants to be deleted
| })(); | ||
|
|
||
|
|
||
| // node index.js palette-bitmap.bmp transformed-palette-bitmap.bmp invert No newline at end of file |
| const readFileHelper = module.exports = (filePath, rfCallback) => { | ||
| if(filePath.indexOf('.bmp') < 0) throw new Error(`${filePath} is not a bmp file. Please visit https://online-converting.com/image/convert2bmp/ to convert this image to a bmp file.`); | ||
| if(typeof filePath !== 'string' || typeof rfCallback !== 'function') throw new Error('argument data type error'); | ||
| // if(arguments.length !== 2) throw new Error('must have exactly 2 arguments'); |
|
|
||
| const transformFileHelper = module.exports = (data, transformation, tfCallback) => { | ||
| if(typeof data === 'object' && data.constructor !== Buffer || typeof data !== 'object' || typeof transformation !== 'object' && data.constructor !== Array || typeof transformation !== 'object' || typeof tfCallback !== 'function') throw new Error('argument data type error'); | ||
| // if(arguments.length !== 5) throw new Error('must have exactly 3 arguments'); |
There was a problem hiding this comment.
A lot of corpse code in this file
| const writeFileHelper = module.exports = (data, transformedFilePath, wfCallback) => { | ||
| if(transformedFilePath.indexOf('.bmp') < 0) throw new Error(`${transformedFilePath} is not a bmp file. Please execute your command again with ${transformedFilePath}.bmp as your new file name.`); | ||
| if(typeof data === 'object' && data.constructor !== Buffer || typeof data !== 'object' || typeof transformedFilePath !== 'string' || typeof wfCallback !== 'function') throw new Error('argument data type error'); | ||
| // if(arguments.length !== 5) throw new Error('must have exactly 3 arguments'); |
| }); | ||
| }); | ||
|
|
||
| describe('fileTransformer invertedverticalmirror', () => { |
There was a problem hiding this comment.
invertedverticalmirror and invertedhorizontalmirror don't match what is written in the README documentation. (horizontalmirrorinverted and verticalmirrorinverted) As a result, if user tries to run transforms using only the README documentation, two of the transforms seems unable to complete.
| return eval(`bmData${returnString}`); | ||
| })(); | ||
| // console.log('bmdata.buffer ', bmData.buffer.toString('hex'), 'bm data.buffer '); | ||
| console.log('beginning: ', bmData.buffer.slice(1078, 11078).toString('hex'), 'beginning: '); |
There was a problem hiding this comment.
Output wants less console logging, to make it cleaner/easier to read
|
|
||
| BmData.prototype.whitereplace = function() { | ||
| for(var i = 0; i <this.colorTableBuffer.length; i+=4) { | ||
| if(this.colorTableBuffer[i] == 255 && this.colorTableBuffer[i+1] == 255 && this.colorTableBuffer[i+2] == 255) { |
There was a problem hiding this comment.
Redundancy can be reduced and code have be more easily understandable if redundant data is assigned to variables that can be reused
No description provided.