-
Notifications
You must be signed in to change notification settings - Fork 79
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
Fix for #16 and a few bonus changes #17
Conversation
…he constructor becomes slightly faster (`if`s are passed once, not eight times)
… `littleEndian` argument (which is known only at runtime, not at the constructor)
I'm sorry for the delay but I've been really busy the last few weeks, I'm going to take a look at it as soon as I find some time :) Thanks for working on it, that's awesome btw! |
Thank you for your attention. I understand that this pull request is larger than the other two that you merged today and thus it will take more time to evaluate. By the way, the 28a3ab9 commit brings here several lines of code from the already merged #19 to avoid a merge conflict in msysgit that I encountered today. |
Of course, this should be done carefully. I guess the jDataView's version has to be pulled — and then the new jParser made to require that new version. |
Tests are done, and now jParser is the only thing that remains to be rewritten after #22 is fixed. |
I'm going to sleep, I'll do that tomorrow :) Thanks a lot for the help on it |
:) |
jParser would be corrected by vjeux/jParser#1 and that fix seems backwards-compatible (contrary to what I feared). Thus the version bump to 1.1.0 here does not seem necessary for jParser, but may still be handy for other modules out there. |
…eem to appear in DataView.prototype
if (jDV._isArrayBuffer && (jDV._start + byteOffset) % size === 0 && (size === 1 || littleEndian)) { | ||
// ArrayBuffer: we use a typed array of size 1 if the alignment is good | ||
// ArrayBuffer does not support endianess flag (for size > 1) | ||
return new window[type + 'Array'](this.buffer, this._start + byteOffset, 1)[0]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we are in node and use an ArrayBuffer, it's going to crash as window does not exist.
…js compatibility)
Fixed, thanks. |
That new (separate) pull request is #24. |
window[type + 'Array']
instead ofall[type + 'Array']
, otherwise several tests fail in Firefox 13 withall is not defined
.Expected at least one assertion, but none were run - call expect(0) to accept zero assertions
message.arguments.callee
is expensive, and forbidden in ECMAScript 5 strict mode, and should be avoided in favour of the function's name unless it's anonymous. Having considered that, I usedthis instanceof jDataView
instead ofthis instanceof arguments.callee
in the constructor.