Socket
Socket
Sign inDemoInstall

@jsonhero/fuzzy-json-search

Package Overview
Dependencies
1
Maintainers
2
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @jsonhero/fuzzy-json-search

VSCode style fuzzy search for JSON documents


Version published
Weekly downloads
75
increased by134.38%
Maintainers
2
Created
Weekly downloads
 

Readme

Source

VSCode style fuzzy search for JSON documents

🚀 Features

  • Use VSCode style fuzzy search on a JSON document
  • Searches through key names, path, raw values and formatted values

💻 Usage

Install Fuzzy JSON Search

$ npm install --save @jsonhero/fuzzy-json-search

The simplest way to search is to create an instance of JSONHeroSearch and pass it a JSON object:

const response = await fetch("https://jsonplaceholder.typicode.com/todos");
const json = await response.json();

const searcher = new JSONHeroSearch(json);

const results = searcher.search("user");

API

JSONHeroSearch.search(query: string)

Performs a fuzzy search against the entire document, ordering by score. Will only return results that score more than 0.

Returns Array<SearchResult<string>>>

SearchResult<string> has the following properties:

item is a string representing the path to the key
score is an ItemScore
ItemScore has the following properties
score is a number, the higher the score the better a match
labelMatch is an array of Match objects
descriptionMatch is an array of Match objects
rawValueMatch is an array of Match objects
formattedValueMatch is an array of Match objects
Match is type { start: number; end: number }

Keywords

FAQs

Last updated on 22 Apr 2022

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc