kentcdodds / match-sorter

Simple, expected, and deterministic best-match sorting of an array in JavaScript

Home Page:https://npm.im/match-sorter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Escape period?

nathanforce opened this issue · comments

  • match-sorter version: 2.3.0
  • node version:
  • npm (or yarn) version:

Relevant code or config

const placeholders = [{ searchTerms: [project!.slug, 'slug', 'project.slug'] }];

const matches = matchSorter(placeholders, 'project.slug', {
    keys: ['searchTerms'],
});

What you did: Searching for the string "project.slug" returns an empty result.

Problem description: I want to be able to search for the string "project.slug" and match the item in the placeholders array.

Suggested solution: ?

Hmmm... Seems like a bug I think. Could you make a reproduction you and I (and anyone else) can look into?

Nevermind. The bug was caused by another lib (the one providing my searchTerm) not allowing period. Sorry for wasting your time!

HOT TAKE: match-sorter is your best lib

I'm glad you like it!