Socket
Socket
Sign inDemoInstall

fuse.js

Package Overview
Dependencies
0
Maintainers
1
Versions
113
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

fuse.js


Version published
Weekly downloads
2.1M
decreased by-21.06%
Maintainers
1
Created
Weekly downloads
 

Package description

What is fuse.js?

Fuse.js is a powerful, lightweight fuzzy-search library, with zero dependencies. It provides a simple way to perform approximate string matching (fuzzy searching) by searching for patterns in text, which is useful for implementing features like search-as-you-type, autocomplete, and other search-related functionalities.

What are fuse.js's main functionalities?

Simple Search

This feature allows you to perform a simple fuzzy search on a list of items. The code sample demonstrates searching for the term 'old man' in an array of book titles.

const Fuse = require('fuse.js');
const books = [{ title: 'Old Man's War' }, { title: 'The Lock Artist' }];
const fuse = new Fuse(books, { keys: ['title'] });
const result = fuse.search('old man');

Weighted Search

This feature allows you to perform a search where each field can have a different weight, affecting the relevance of search results. The code sample demonstrates a weighted search where the author field has a higher weight than the title.

const Fuse = require('fuse.js');
const books = [{ title: 'Old Man's War', author: 'John Scalzi' }, { title: 'The Lock Artist', author: 'Steve Hamilton' }];
const fuse = new Fuse(books, { keys: [{ name: 'title', weight: 0.3 }, { name: 'author', weight: 0.7 }] });
const result = fuse.search('john');

Extended Search

This feature allows you to use an extended search syntax to perform searches that include logical operators. The code sample demonstrates searching for items that do not include the word 'lock'.

const Fuse = require('fuse.js');
const books = [{ title: 'Old Man's War' }, { title: 'The Lock Artist' }];
const options = { includeMatches: true, useExtendedSearch: true };
const fuse = new Fuse(books, options);
const result = fuse.search('!lock');

Other packages similar to fuse.js

Changelog

Source

Version 5.0.6-beta

  • Fixed (#357)

Readme

Source

Fuse.js logo

Node.js CI Version Downloads Contributors License

What's new in v5 (beta)
  • Added ability to search patterns longer than 32 characters
  • Added enhanced searching
  • Added indexing for increased performance over large lists

Introduction

Fuse.js is a lightweight fuzzy-search, in JavaScript, with zero dependencies.

Documentation

To checkout out live examples and docs, visit fusejs.io.

Installation

NPM

# latest
$ npm install --save fuse.js

Contributing

Coding conventions

Code should be run through Standard Format.

Testing

Before submitting a pull request, please add the relevant tests in the test/ directory, and execute them via npm test.

Keywords

FAQs

Last updated on 18 Mar 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc