# seaq

> ES6 Text Search.

Latest version **1.1.5** (published 2021-03-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install seaq
pnpm add seaq
yarn add seaq
bun add seaq
```

## Health

**Score 45/100 (D)** — status: abandoned.

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

Warnings: low downloads.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.1.5 |
| Published | 2021-03-04 |
| First published | 2017-01-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=10 |
| Dependencies | 0 |
| Unpacked size | 67.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Stephen Laughton |
| Maintainers | stephenlaughton |
| Keywords | search, string_score, fuzzy |

## Links

- npm: https://www.npmjs.com/package/seaq
- Repository: https://github.com/stephenlaughton/seaq
- Homepage: https://github.com/stephenlaughton/seaq#readme
- Issues: https://github.com/stephenlaughton/seaq/issues
- npm.io page: https://npm.io/package/seaq

## Alternatives

- [@mce/gif](https://npm.io/package/@mce/gif.md) — 2.6K weekly downloads
- [cleanse](https://npm.io/package/cleanse.md) — 173 weekly downloads
- [str](https://npm.io/package/str.md) — 127 weekly downloads
- [naming](https://npm.io/package/naming.md) — 95 weekly downloads
- [tap-telco-api](https://npm.io/package/tap-telco-api.md) — 19 weekly downloads

## Recent versions

- 1.1.5 (latest) — 2021-03-04
- 2.0.0-rc.2 (next) — 2026-05-26
- 2.0.0-rc.1 — 2026-02-13
- 1.1.4 — 2020-02-20
- 1.1.3 — 2019-03-18
- 1.1.2 — 2017-10-16
- 1.1.1 — 2017-10-10
- 1.1.0 — 2017-10-06
- 1.0.0 — 2017-01-08

## README

# Seaq - Real nice ES6 fuzzy string search

Seaq is an ES6 string search library heavily inspired by [Fuse.js](https://github.com/krisk/fuse). It is built in [Typescript](https://github.com/Microsoft/TypeScript) implementing the fantastic [string_score](https://github.com/joshaven/string_score) string matching algorithm.

| Statements                                                                  | Branches                                                                  | Functions                                                                  | Lines                                                                  |
| --------------------------------------------------------------------------- | ------------------------------------------------------------------------- | -------------------------------------------------------------------------- | ---------------------------------------------------------------------- |
| ![Statements](https://img.shields.io/badge/Coverage-100%25-brightgreen.svg) | ![Branches](https://img.shields.io/badge/Coverage-100%25-brightgreen.svg) | ![Functions](https://img.shields.io/badge/Coverage-100%25-brightgreen.svg) | ![Lines](https://img.shields.io/badge/Coverage-100%25-brightgreen.svg) |

## Basic usage

```typescript
import { seaq } from 'seaq';

const contacts = [ { name: 'John', ... }, { name: 'Jane', ... }];
const queryString = 'jo';

const orderedContacts = seaq(contacts, queryString, ['name']);
```

## API

```typescript
/**
 * Given an input list Array<T>, a set of object keys to search, and a search
 * query, Seaq will return a new Array<T> containing the results ordered by
 * their Score which is calculated using a variation of string_score algorithm.
 *
 * @export
 * @template T generic
 * @param {Array<T>} list list of objects or strings to search
 * @param {string} query query string to match against keys in objects
 * @param {(Array<Extract<keyof T, string>> | string[])} keys optional keys to search in the object
 * @param {number} [fuzzy] optional fuzziness should be between 0 and 1. low fuzziness like 0.01 means a mismatch will drop the score more then a fuzziness of something like 0.9.
 * @returns {Array<T>}
 */
export function seaq<T>(
  list: Array<T>,
  query: string,
  keys?: Array<Extract<keyof T, string>> | string[],
  fuzzy?: number,
): Array<T>;
```

## Performance

Running `yarn benchmark` yields the follow results comparing `seaq` to [`Fuse.js`](https://github.com/krisk/Fuse)
![Benchmark](./benchmark.png)
Granted this is not an apples to apples comparison because `Fuse.js` and `seaq` provide very different results. `seaq` has fewer configuration options and may not be flexible enough for some use-cases. But generally, if performance is your primary concern, `seaq` may be the right tool for the job.

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