It also preserves the arrayIndex which was what the item was incorrectly set to.
I realize this is a breaking change but current behavior doesn't make sense to me.
On the homepage: https://fusejs.io/ it only shows search through lists of objects so this issue isn't known until it happens.
My current work around is to wrap each string to make it an object to get the upgraded behavior of fuse.js
The results of the
search
are different if thelist
given to the constructor ofFuse
is a list of strings (string[]
) vs a list of objects (IObject[]
)Example:
String Results:
Object Results (each string wrapped with object in
name
property) withkeys: ["name"]
specified:Problems
item
field should be the same type as the given items.E.g. For objects it follow that:
T[]
->T
But for strings it is:string[]
->number
It should bestring[]
->string
If you have code written to go through arbitrary results from fuse and it expects the
item
to actually be one of the items given it will beak!I expect the object to be shaped consistently like this:
It also preserves the
arrayIndex
which was what theitem
was incorrectly set to.I realize this is a breaking change but current behavior doesn't make sense to me. On the homepage: https://fusejs.io/ it only shows search through lists of objects so this issue isn't known until it happens.
My current work around is to wrap each string to make it an object to get the upgraded behavior of fuse.js
Is there any other way?