Skip to content
This repository was archived by the owner on Aug 5, 2021. It is now read-only.
This repository was archived by the owner on Aug 5, 2021. It is now read-only.

Wrong prefix match  #53

@sualko

Description

@sualko

isEqual: function(a, b) {
// TODO: Special-case arraybuffers, etc
if (a === undefined || b === undefined) {
return false;
}
a = util.toString(a);
b = util.toString(b);
var maxLength = Math.max(a.length, b.length);
if (maxLength < 5) {
throw new Error("a/b compare too short");
}
return a.substring(0, Math.min(maxLength, a.length)) == b.substring(0, Math.min(maxLength, b.length));
}

I think someone tried here to implement a prefix match, but it should not work, because it's the same as

return a.substring(0, a.length) == b.substring(0, b.length);

Am I right, or did I overlook something? Are you interested in a pr?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions