-
Notifications
You must be signed in to change notification settings - Fork 1
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
Universal ts lib moving last array utils method from node core #331
Universal ts lib moving last array utils method from node core #331
Conversation
export async function callChunked<Item>( | ||
chunkSize: number, | ||
array: readonly Item[], | ||
processFn: (arrayChunk: Item[]) => Promise<unknown>, | ||
): Promise<void> { |
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.
With this one, all array utils from node-core are already here, so we plan removing them from there
* @deprecated Use `areArraysEqual` instead. | ||
* |
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.
I thought that we can have something more common, and not only for string arrays
/** | ||
* Check if two arrays are equal. | ||
* The arrays are considered equal if they have the same length, same order and the elements at each index by value are equal. | ||
* Note: Equality is compared by value and not by reference. | ||
*/ | ||
export function areArraysEqual(a: unknown[], b: unknown[]): boolean { |
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.
Thinking about having areEquals
so it can be also used to compare objects, still thinking about it
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.
from perf perspective separate functions are better, because isomorphic params (different structure across multiple calls) will cause v8 to deoptimize.
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.
I am not sure, my idea was to have something like:
areEquals(a: unknown, b: unknown): boolean
it won't use isomorphic params but not sure if v8 will deoptimize it
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.
As an example -> db19fb8
Will open a new PR with final version |
Changes
Please describe
Checklist
major
,minor
,patch
orskip-release