Open
Conversation
Uzlopak
reviewed
Aug 15, 2023
index.js
Outdated
|
|
||
| functionCode += ` | ||
| if (!Array.isArray(obj)) { | ||
| if (!Array.isArray(obj) && !(obj != null && (${supportedTypedArrays.map(type => ' obj.constructor.name === \'' + type + '\' ').join('||')}) )) { |
Contributor
There was a problem hiding this comment.
ugh. It would be better to put the array in a "global" scope and make an indexOf by the obj.constructor.name than this imho.
I think this will slow down array significantly.
Author
There was a problem hiding this comment.
I am not familiar with perf implications here.
Would Array.includes also be worth testing?
ivan-tymoshenko
requested changes
Aug 15, 2023
Member
ivan-tymoshenko
left a comment
There was a problem hiding this comment.
This would not work in places where we use Ajv. To test it put an array under anyOf, oneOf or if.
|
PR: MASTER: |
Author
It seems like there is no way to solve this? |
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.
I have added support for
Uint8Arraywith a test showing that it works as expected. No additional types have been created, this works by simply treating aUint8Arraylike a normalarray. Afaik, you cannot create a nested array this way so the changes are quite limited.Support for more types of
TypedArrayis easy to add but as I worked on this issue further I realised that there may be wider implications for this:TypedArrayshould be supported?Related to - #626 - I haven't verified the performance difference either, I am assuming this can only come from removing type checks?
Checklist
npm run testandnpm run benchmarkand the Code of conduct