-
Notifications
You must be signed in to change notification settings - Fork 77
Open
Description
Context
While searching for a repo on the SWR framework in React to check the hash implementation for multiple argument passing, I came across a Vue repo on hash implementation by chance.
Problem
While reviewing the hash function implementation, I noticed that the hash value for object/function types seems incorrect. Basically, it assigns a counter as the hash value for these types. This means that if I pass a list of objects rather than strings as arguments, the resulting hash values would be the same.
if (!table.has(args[i])) {
_hash = counter;
table.set(args[i], counter++);
} else {
_hash = table.get(args[i]);
}
For reference, here's the hash function from the SWR React implementation that recursively handles non-string types, please check the link.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels