I have a:
No behavior change; it's just performance bug.
I'm proposing the following trivial change:
The current behavior has quadratic complexity, with two nested loops (over all old and new keys). So for a map with a few thousands elements it may take ages, while values.has is supposed to be a constant-time operation (leading to linear overall complexity).
Note that values is not neccessarily a Map, it can be object { key: value } or array [[key,value]], so you may need to convert it first:
if (isPlainObject(values)) {
// could be done in single pass, but whatever
values = Object.entries(values);
}
if (Array.isArray(values)) {
values = new Map(values);
}
However I think we should resolve #1980 first.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This issue has been automatically unmarked as stale. Please disregard previous warnings.
PR #2057 merged and waiting for the release
published
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs or questions.
Most helpful comment
Note that
valuesis not neccessarily aMap, it can be object{ key: value }or array[[key,value]], so you may need to convert it first:However I think we should resolve #1980 first.