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

lazy-search

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

lazy-search

With just a little typing, you can find exactly what you want from your contents!

  • 1.0.3
  • unpublished
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

NPM version GitHub issues Travis

With just a little typing, you can find exactly what you want from your contents! This library is implemented with a search function similar to the directory search used in Intellij.

Installation

The easiest way to install lazy-search is with npm.

npm i lazy-search

Alternately, download the source.

git clone https://github.com/stegano/lazy-search.git

API

LazySearch.prototype.find(contents, searchKeyword) : Object[]

  • contents: You can enter content such as the content of a news article or a file path or anything.
  • searchKeyword: Keyword to search, search keywords do not have to be exact.

Examples

You can search even if your query is not correct, like the code below.

var lazySearch = new LazySearch();
var contents = "Ttttest apple eeeee";
var mySearchKeyword = "aple"; // <- You probably wanted to search for "Apple" :)
var result = lazySearch.find(contents, mySearchKeyword); // -> [{"_rawData":[{"char":"a","index":8},{"char":"p","index":9},{"char":"l","index":11},{"char":"e","index":12}],"contents":"apple","distance":1}]

Result: Object[]

  • _rawData: LazySearch performs a search for each character. Store the character's position in _rawData.
    • char: The character found in the content.
    • index: The position of the character in the contents.
  • contents: The string that most matches the search keyword.
  • distance: The closer the search keyword is, the closer the distance value is to 1.

Docs

Create an API document using JSDoc.

npm install
npm run doc

Tests

To run the test suite, first install the dependencies, then run npm test

npm ininstall
npm test

Keywords

FAQs

Package last updated on 11 Sep 2017

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