Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
@types/react-highlight-words
Advanced tools
TypeScript definitions for react-highlight-words
@types/react-highlight-words provides TypeScript definitions for the react-highlight-words package, which is a React component for highlighting words within a larger body of text.
Basic Highlighting
This feature allows you to highlight specific words within a larger body of text. The `searchWords` array contains the words to be highlighted, and `textToHighlight` is the text where the words will be highlighted.
import Highlighter from 'react-highlight-words';
const text = 'The quick brown fox jumps over the lazy dog';
const searchWords = ['quick', 'fox', 'lazy'];
<Highlighter
highlightClassName="YourHighlightClass"
searchWords={searchWords}
autoEscape={true}
textToHighlight={text}
/>;
Custom Highlighting Styles
This feature allows you to apply custom styles to the highlighted words. The `highlightStyle` prop is used to define the CSS styles for the highlighted words.
import Highlighter from 'react-highlight-words';
const text = 'The quick brown fox jumps over the lazy dog';
const searchWords = ['quick', 'fox', 'lazy'];
<Highlighter
highlightStyle={{ backgroundColor: 'yellow', fontWeight: 'bold' }}
searchWords={searchWords}
autoEscape={true}
textToHighlight={text}
/>;
Case Insensitive Highlighting
This feature allows you to perform case-insensitive highlighting. By setting the `caseSensitive` prop to `false`, the component will highlight words regardless of their case.
import Highlighter from 'react-highlight-words';
const text = 'The quick brown fox jumps over the lazy dog';
const searchWords = ['Quick', 'FOX', 'lazy'];
<Highlighter
highlightClassName="YourHighlightClass"
searchWords={searchWords}
autoEscape={true}
caseSensitive={false}
textToHighlight={text}
/>;
react-text-highlighter is another React component for highlighting text. It offers similar functionality to react-highlight-words but with a different API. It allows for more customization options and supports nested highlights.
react-string-replace is a utility for safely replacing substrings in a string with React components. While it is not specifically designed for highlighting, it can be used to achieve similar results by replacing words with styled components.
react-markdown is a React component for rendering Markdown. It supports custom renderers, which can be used to highlight specific words or phrases within the Markdown content. It is more versatile but requires more setup for highlighting specific words.
npm install --save @types/react-highlight-words
This package contains type definitions for react-highlight-words (https://github.com/bvaughn/react-highlight-words#readme).
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-highlight-words.
These definitions were written by Mohamed Hegazy, and Kelly Milligan.
FAQs
TypeScript definitions for react-highlight-words
The npm package @types/react-highlight-words receives a total of 199,856 weekly downloads. As such, @types/react-highlight-words popularity was classified as popular.
We found that @types/react-highlight-words demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.