tiny-binary-format
tiny-binary-format copied to clipboard
Add warnings or errors for numbers that are going to break
Because Javascript doesn't support bitwise operations on numbers > 32 bit integers, we need to provide some kind of heads up when someone creates a format with a field length that will break.
If someone tries to create a field that's not a number, is a floating point number, or is an integer bigger than we can manipulate with a bitwise operators, then throw some pretty liberal errors. As long as this stuff lives within the constructor, it should be fine.
If you can think of any other edge cases that could also be troublesome, leave a comment here or send a PR.
Additionally, should pack() give warnings/throw errors if supplied invalid input? For example: input exceeding field range, input NaN/noninteger, input count does not match field count, etc?