TypedArray improvements and tests#39
Merged
jasongin merged 1 commit intonodejs:masterfrom May 23, 2017
Merged
Conversation
addaleax
approved these changes
May 21, 2017
| if (!(type == TypedArrayTypeForPrimitiveType<T>() || | ||
| (type == napi_uint8_clamped_array && std::is_same<T, uint8_t>::value))) { | ||
| throw TypeError::New(env, "Array type must match the template parameter. " | ||
| " (Uint8 arrays may optionally have the \"clamped\" array type.)"); |
Member
There was a problem hiding this comment.
This will result in a double space when the strings are concatenated across lines, I’m not sure that’s intended? (Also, I think I’d just spell it as Uint8Arrays)
Member
Author
There was a problem hiding this comment.
I'll remove the extra space.
I didn't refer to Uint8Array specifically because that's just a typedef; Some people may prefer to just use TypedArrayOf<uint8_t> instead.
- Rename TypedArray_<> to TypedArrayOf<> - Remove the second template parameter from TypedArrayOf<>, because it can be (usually) inferred from the first parameter and is only needed at object construction time. - Remove the TypedArray::As*Array() methods, which were redundant because they did the same thing as Value::As(). - Add doc-comments to ArrayBuffer, TypedArray, and TypedArrayOf<> classes - Add tests for typed arrays
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TypedArray_<>toTypedArrayOf<>.TypedArrayOf<>, because it can be (usually) inferred from the first parameter and is only needed at object construction time.TypedArray::As*Array()methods, which were redundant because they did the same thing asValue::As().ArrayBuffer,TypedArray, andTypedArrayOf<>classes.