Skip to content

Unconsistent and incorrect indexes #31

Description

@GreenFlag31

Hi,

I have noticed an unconsistent and incorrect behaviour of the match index and length.

Considering following example:

const searched = 'exercice';
const text = 'Total of the exerciice';

const fuzzied = fuzzy(searched, text, {
  returnMatchData: true,
});

console.log(fuzzied);
const end = fuzzied.match.index + fuzzied.match.length;
console.log('matching text: ', text.substring(fuzzied.match.index, end));

image

It logs 15 with a length of 7.
Expected would be 13 with a length of 6. The matching data between the text and searched is exerci and not erciice (is thus the score also miscomputed?).

Could you take a look at it ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions