You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

autosuggest-highlight

Package Overview
Dependencies
Maintainers
3
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

autosuggest-highlight

Utilities for highlighting text in autosuggest and autocomplete components

3.3.4
latest
Source
npmnpm
Version published
Weekly downloads
446K
-0.29%
Maintainers
3
Weekly downloads
 
Created

What is autosuggest-highlight?

The autosuggest-highlight npm package is used to highlight matching parts of suggestions in an autosuggest component. It is particularly useful in search interfaces where you want to visually emphasize the parts of the suggestion that match the user's input.

What are autosuggest-highlight's main functionalities?

Highlight Matching Parts

This feature allows you to highlight the parts of a suggestion that match the user's input. The `match` function finds the matching parts, and the `parse` function splits the text into highlighted and non-highlighted parts.

const highlight = require('autosuggest-highlight');
const text = 'California';
const query = 'cal';
const matches = highlight.match(text, query);
const parts = highlight.parse(text, matches);
console.log(parts); // [{ text: 'Cal', highlight: true }, { text: 'ifornia', highlight: false }]

Other packages similar to autosuggest-highlight

Keywords

autosuggest

FAQs

Package last updated on 24 Jul 2022

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.