# fuzzy-search

> Simple fuzzy search

Latest version **3.2.1** (published 2020-02-20) · ISC license · 0 weekly downloads

## Install

```sh
npm install fuzzy-search
pnpm add fuzzy-search
yarn add fuzzy-search
bun add fuzzy-search
```

## Health

**Score 28/100 (F)** — status: abandoned.

Positive: has types package; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.2.1 |
| Published | 2020-02-20 |
| First published | 2016-04-23 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | separate (@types/fuzzy-search) |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 327.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 227 |
| Author | Wouter Rutgers |
| Maintainers | wouter2203 |
| Keywords | fuzzy, search, javascript |

## Links

- npm: https://www.npmjs.com/package/fuzzy-search
- Repository: https://github.com/wouter2203/fuzzy-search
- Homepage: https://github.com/wouter2203/fuzzy-search#readme
- Issues: https://github.com/wouter2203/fuzzy-search/issues
- npm.io page: https://npm.io/package/fuzzy-search

## Alternatives

- [jsforce](https://npm.io/package/jsforce.md) — 851.2K weekly downloads
- [react-native-qrcode-svg](https://npm.io/package/react-native-qrcode-svg.md) — 693.5K weekly downloads
- [@salesforce/plugin-data](https://npm.io/package/@salesforce/plugin-data.md) — 394.9K weekly downloads
- [@backstage/plugin-search-common](https://npm.io/package/@backstage/plugin-search-common.md) — 308.5K weekly downloads
- [@chain-registry/types](https://npm.io/package/@chain-registry/types.md) — 38.4K weekly downloads

## Recent versions

- 3.2.1 (latest) — 2020-02-20
- 3.2.0 — 2020-02-18
- 3.1.0 — 2020-01-22
- 3.0.2 — 2019-10-27
- 2.2.1 — 2019-01-09
- 3.0.1 — 2019-01-09
- 3.0.0 — 2018-12-26
- 2.2.0 — 2018-12-26
- 2.1.0 — 2018-06-07
- 2.0.1 — 2017-10-17
- 2.0.0 — 2017-09-15
- 1.5.0 — 2017-09-15
- 1.4.0 — 2016-11-20
- 1.3.8 — 2016-11-20
- 1.3.7 — 2016-11-20
- … 15 more at https://npm.io/package/fuzzy-search/versions

## README

# Fuzzy search

*Simple lightweight Fuzzy Search library written in JavaScript, with zero dependencies!*

[![Travis](https://img.shields.io/travis/wouter2203/fuzzy-search/master.svg)](https://travis-ci.org/wouter2203/fuzzy-search)
[![npm](https://img.shields.io/npm/v/fuzzy-search.svg)](https://www.npmjs.com/package/fuzzy-search)
[![npm](https://img.shields.io/npm/dm/fuzzy-search.svg)](https://www.npmjs.com/package/fuzzy-search)
[![Donate](https://img.shields.io/badge/paypal-donate-yellow.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=NUA68T5TCC2BN)

## Installation

> Using npm

`npm install fuzzy-search --save`

> Using `<script>`

`<script src="FuzzySearch.js"></script>`

## Quick start guide
```javascript
// This can be excluded when loaded via <script>
import FuzzySearch from 'fuzzy-search'; // Or: var FuzzySearch = require('fuzzy-search');

const people = [{
  name: {
    firstName: 'Jesse',
    lastName: 'Bowen',
  },
  state: 'Seattle',
}];

const searcher = new FuzzySearch(people, ['name.firstName', 'state'], {
  caseSensitive: true,
});
const result = searcher.search('ess');
```

## Documentation
```javascript
const searcher = new FuzzySearch(<haystack>, [keys], [options]);
const result = searcher.search(<needle>);
```

**haystack** *(type: `Array`)*

Array of objects containing the search list.

---

**[keys]** *(type: `Array`, default: `[]`)*

List of properties that will be searched. This also supports nested properties.

---

**[options]** *(type: `Object`)*

Object with options that will configure the search. Scroll/Swipe down to see more information on what options are available.

---

**\<needle\>** *(type: `String`, default: `''`)*

The string to Fuzzy Search on.

### Options
**caseSensitive** *(type: `Boolean`, default: `false`)*

Indicates whether comparisons should be case sensitive.

**sort** *(type: `Boolean`, default: `false`)*

When `true` it will sort the results by best match (when searching for `abc` in the search set `['a__b__c', 'abc']` it would return `abc` as the first result).

When `false` it will return the results in the original order.

---
_Source: https://npm.io/package/fuzzy-search · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
