Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fuse-immutable

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fuse-immutable

Lightweight fuzzy-search for Immutable.js (Based on Fuse.js by krisk)

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
292
decreased by-27.9%
Maintainers
1
Weekly downloads
 
Created
Source

fuse-immutable

Lightweight fuzzy-search for Immutable.js (Based on Fuse.js by krisk)

Twitter URL

Table of Contents

How is this different than Fuse.js?

The obvious difference is that it works with Immutable.js data. Instead of an array for your list argument, pass in an Immutable.List.

One other key difference is the results when using tokenize and matchAllTokens together. Fuse.js will return items that have a single value that matches all tokens. fuse-immutable returns items where each token can be found somewhere in the item.

import { fromJS } from 'immutable'
import Fuse from 'fuse-immutable'

const list = fromJS([{
  title: 'Jackson',
  author: 'Steve Pearson',
  tags: ['Kevin Wong', 'Victoria Adam', 'John Smith']
}, {
  title: 'The life of Jane',
  author: 'John Smith',
  tags: ['Jane', 'Jackson', 'Sam']
}, {
  title: 'The life of John',
  author: 'Jane Wong',
  tags: ['Victoria Adam', 'John Pearson']
}])

const options = {
  threshold: 0,
  tokenize: true,
  matchAllTokens: true,
}

const fuse = new Fuse(list, options)

console.log(fuse.search('Jackson Wong'))
// List [
//   Map {
//    "title": "Jackson",
//    "author": "Steve Pearson",
//    "tags": List [ "Kevin Wong", "Victoria Adam", "John Smith" ]
//   }
//  ]

Contributing

Coding conventions

Code should be run through Standard Format.

Testing

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

Keywords

FAQs

Package last updated on 09 Jan 2018

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc