Skip to content

Allow to use functions instead of strings for keys specification #99

@Phyks

Description

@Phyks

Hi,

When using Immutable.JS, one has to convert back and forth between Immutable objects and JavaScript objects, to pass them to Fuse.

If we could use functions to specify which key to use, it would allow the use of non-array objects such as Immutable ones:

var books = Immutable.fromJS([{
  title: "Old Man's War"
  author: {
    firstName: "John",
    lastName: "Scalzi"
  }
}]);

var fuse = new Fuse(books, { keys: [item -> item.title, item -> item.getIn(["author", "firstName"])] });

Thanks

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions