FZF for JavaScript

Do fuzzy matching using FZF algorithm in JavaScript
GitHub
903
Created 3 years ago, last commit 4 months ago
5 contributors
239 commits
Stars added on GitHub, month by month
0
12
1
2
3
4
5
6
7
8
9
10
11
2023
2024
Stars added on GitHub, per day, on average
Yesterday
=
Last week
+0.3
/day
Last month
+0.3
/day
Last 12 months
+0.2
/day
npmPackage on NPM
fzf
0.5.2
Monthly downloads on NPM
12
1
2
3
4
5
6
7
8
9
10
11
2023
2024
No dependencies
README

FZF for JavaScript

Tests Docs deployment status

Docs · Demo · GitHub · NPM

Originally available as a fuzzy finder for CLIs, FZF for JavaScript is a port of FZF's main algorithm so it can be used in browser context.

Quick look

Install FZF for JavaScript using:

npm i fzf

Then you can use it like:

import { Fzf } from 'fzf'

const list = ['go', 'javascript', 'python', 'rust', 
              'swift', 'kotlin', 'elixir', 'java', 
              'lisp', 'v', 'zig', 'nim', 'rescript', 
              'd', 'haskell']

const fzf = new Fzf(list)
const entries = fzf.find('li')
console.log('ranking is:')
entries.forEach(entry => console.log(entry.item)) // lisp kotlin elixir

For more ways to use this library, visit documentation.

Motivation

Command palette is becoming ubiquitous – you can find it in code editors (Sublime Text, VS Code), design tools (Figma), project management apps (Height, Linear), source control tools (Fork, Sublime Merge). Web apps are becoming more prevalent as well. FZF has a great fuzzy finding mechanism which could be used outside of CLI and into these palettes.

There is a very good read about command palettes if you want to learn more.

Thanks