-
-
Notifications
You must be signed in to change notification settings - Fork 76
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
Refactoting of decoder for better maintainability #76
Commits on Apr 22, 2019
-
Configuration menu - View commit details
-
Copy full SHA for a0f5f62 - Browse repository at this point
Copy the full SHA a0f5f62View commit details
Commits on Apr 23, 2019
-
Refactoring: inlining hasMinBufferSize and simplifying decode(buf)
Changes to be committed: modified: lib/decoder.js
Configuration menu - View commit details
-
Copy full SHA for 12f63ee - Browse repository at this point
Copy the full SHA 12f63eeView commit details -
Configuration menu - View commit details
-
Copy full SHA for 991cc76 - Browse repository at this point
Copy the full SHA 991cc76View commit details -
In decodeMap(...) simplify counting amount of bytes consumed
Well, provided that initialOffset is the value passed as an argument: console.log(headerLength + totalBytesConsumed === offset - initialOffset) // true --- always
Configuration menu - View commit details
-
Copy full SHA for 287d374 - Browse repository at this point
Copy the full SHA 287d374View commit details -
1. getSize now is implemented through hash not switch statement. More concise and appear to be much faster. 2. Created helpers.js file, and functions that logically unrelated to decoding/encoding will go there. 3. Where possible prefer flat code that nested branches 4. In decodeExt dramatically simplify all the things. Changes to be committed: modified: lib/decoder.js new file: lib/helpers.js
Configuration menu - View commit details
-
Copy full SHA for f7345f0 - Browse repository at this point
Copy the full SHA f7345f0View commit details -
Getting rid of "offset + 1" artificial expression
It's caused by not incrementing offset after reaading first byte. To handle this change I first of all introduce "initialOffset" and change everywhere offset to "initial offset". This commit does this part of the job. Then I will clean 1-by-1 every affected function and branch.
Configuration menu - View commit details
-
Copy full SHA for 8a932aa - Browse repository at this point
Copy the full SHA 8a932aaView commit details -
Keep on getting intent more clear
1. Remove "else" statements that go after "return" 2. Where appropriate (another 1-4 bytes have been read) offset is incremented 3. So that expressions like "initialOffset + 2" --- "... + 5" could be replaced by just "offset" Changes to be committed: modified: lib/decoder.js
Configuration menu - View commit details
-
Copy full SHA for a9ec4fb - Browse repository at this point
Copy the full SHA a9ec4fbView commit details -
Implemented all integers and all kinds of floats
1. function decodeSigned (buf, offset, size) 2. function decodeFloat (buf, offset, size) 3. function decodeExt (buf, offset, type, size, headerSize)
Configuration menu - View commit details
-
Copy full SHA for 11ef5e6 - Browse repository at this point
Copy the full SHA 11ef5e6View commit details -
Added missing Ranges as TODO commends
Currently: | RANGE | STATUS | function name (if exists) or type name | |------------|---------------------|-----------------| | 0x00, 0x7f | MISSING COMPLETELY | positive fixint | 0x80, 0x8f | MISSING COMPLETELY | fixmap | 0x90, 0x9f | MISSING COMPLETELY | fixarr | 0xa0, 0xbf | MISSING COMPLETELY | fixstr | 0xc0, 0xc3 | DONE | decodeConstants(...) | 0xc4, 0xc6 | OLD CODE | decodeBuffers(...) | 0xc7, 0xc9 | WIP NOW | decodeExt(...) | 0xca, 0xcb | DONE | decodeFloat | 0xcc, 0xcf | DONE | decodeUnsignedInt() | 0xd0, 0xd3 | DONE | decodeSigned() | 0xd4, 0xd8 | DONE | decodeFixExt() | 0xd9, 0xdb | OLD CODE | decodeStr(...) | 0xdc, 0xdd | OLD CODE | decodeArray(...) | 0xde, 0xdf | OLD CODE | decodeMap(...) | 0xe0, 0xff | MISSING COMPLETELY | negative fixint
Configuration menu - View commit details
-
Copy full SHA for 65ce0ba - Browse repository at this point
Copy the full SHA 65ce0baView commit details -
Configuration menu - View commit details
-
Copy full SHA for c5789c7 - Browse repository at this point
Copy the full SHA c5789c7View commit details -
Configuration menu - View commit details
-
Copy full SHA for a511bdd - Browse repository at this point
Copy the full SHA a511bddView commit details -
Configuration menu - View commit details
-
Copy full SHA for db3f3e8 - Browse repository at this point
Copy the full SHA db3f3e8View commit details -
Configuration menu - View commit details
-
Copy full SHA for 3ae90f9 - Browse repository at this point
Copy the full SHA 3ae90f9View commit details -
Configuration menu - View commit details
-
Copy full SHA for a902377 - Browse repository at this point
Copy the full SHA a902377View commit details -
Configuration menu - View commit details
-
Copy full SHA for e3546c8 - Browse repository at this point
Copy the full SHA e3546c8View commit details -
Configuration menu - View commit details
-
Copy full SHA for 6319853 - Browse repository at this point
Copy the full SHA 6319853View commit details -
Configuration menu - View commit details
-
Copy full SHA for f2840b6 - Browse repository at this point
Copy the full SHA f2840b6View commit details -
Configuration menu - View commit details
-
Copy full SHA for ebb90c0 - Browse repository at this point
Copy the full SHA ebb90c0View commit details -
Configuration menu - View commit details
-
Copy full SHA for 67d253c - Browse repository at this point
Copy the full SHA 67d253cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 83cb8ac - Browse repository at this point
Copy the full SHA 83cb8acView commit details
Commits on Apr 24, 2019
-
Configuration menu - View commit details
-
Copy full SHA for e3be779 - Browse repository at this point
Copy the full SHA e3be779View commit details -
Configuration menu - View commit details
-
Copy full SHA for f70ee03 - Browse repository at this point
Copy the full SHA f70ee03View commit details -
Configuration menu - View commit details
-
Copy full SHA for c2c4b18 - Browse repository at this point
Copy the full SHA c2c4b18View commit details
Commits on Apr 25, 2019
-
Configuration menu - View commit details
-
Copy full SHA for 6f725ac - Browse repository at this point
Copy the full SHA 6f725acView commit details -
Configuration menu - View commit details
-
Copy full SHA for 76a8958 - Browse repository at this point
Copy the full SHA 76a8958View commit details -
Configuration menu - View commit details
-
Copy full SHA for 8d5003a - Browse repository at this point
Copy the full SHA 8d5003aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 672e68c - Browse repository at this point
Copy the full SHA 672e68cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 698c73e - Browse repository at this point
Copy the full SHA 698c73eView commit details -
Configuration menu - View commit details
-
Copy full SHA for c2e3c1b - Browse repository at this point
Copy the full SHA c2e3c1bView commit details -
Configuration menu - View commit details
-
Copy full SHA for 2cbbaeb - Browse repository at this point
Copy the full SHA 2cbbaebView commit details -
Configuration menu - View commit details
-
Copy full SHA for 4b7f55f - Browse repository at this point
Copy the full SHA 4b7f55fView commit details -
Configuration menu - View commit details
-
Copy full SHA for c53969f - Browse repository at this point
Copy the full SHA c53969fView commit details -
Configuration menu - View commit details
-
Copy full SHA for c80300c - Browse repository at this point
Copy the full SHA c80300cView commit details -
Configuration menu - View commit details
-
Copy full SHA for c02177f - Browse repository at this point
Copy the full SHA c02177fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 1d96857 - Browse repository at this point
Copy the full SHA 1d96857View commit details -
Configuration menu - View commit details
-
Copy full SHA for 45a8340 - Browse repository at this point
Copy the full SHA 45a8340View commit details -
Configuration menu - View commit details
-
Copy full SHA for b5bd1fd - Browse repository at this point
Copy the full SHA b5bd1fdView commit details -
Configuration menu - View commit details
-
Copy full SHA for 40d2871 - Browse repository at this point
Copy the full SHA 40d2871View commit details -
Configuration menu - View commit details
-
Copy full SHA for 311de36 - Browse repository at this point
Copy the full SHA 311de36View commit details -
Configuration menu - View commit details
-
Copy full SHA for 4a404e2 - Browse repository at this point
Copy the full SHA 4a404e2View commit details