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

highlight-words-core

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

highlight-words-core - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

17

dist/index.js

@@ -103,3 +103,3 @@ module.exports =

var autoEscape = _ref.autoEscape;
var sanitizer = _ref.sanitizer;
var sanitize = _ref.sanitize;
var searchWords = _ref.searchWords;

@@ -111,3 +111,3 @@ var textToHighlight = _ref.textToHighlight;

autoEscape: autoEscape,
sanitizer: sanitizer,
sanitize: sanitize,
searchWords: searchWords,

@@ -123,3 +123,2 @@ textToHighlight: textToHighlight

* Takes an array of {start:number, end:number} objects and combines chunks that overlap into single chunks.
* @param chunks {start:number, end:number}[]
* @return {start:number, end:number}[]

@@ -157,5 +156,2 @@ */

* If we find matches, add them to the returned array as a "chunk" object ({start:number, end:number}).
* @param textToHighlight string
* @param searchWords string[]
* @param sanitizer Process and optionally modify text and searchWords before comparison; this can be used to eg. remove accents
* @return {start:number, end:number}[]

@@ -165,8 +161,8 @@ */

var autoEscape = _ref3.autoEscape;
var _ref3$sanitizer = _ref3.sanitizer;
var sanitizer = _ref3$sanitizer === undefined ? identity : _ref3$sanitizer;
var _ref3$sanitize = _ref3.sanitize;
var sanitize = _ref3$sanitize === undefined ? identity : _ref3$sanitize;
var searchWords = _ref3.searchWords;
var textToHighlight = _ref3.textToHighlight;
textToHighlight = sanitizer(textToHighlight);
textToHighlight = sanitize(textToHighlight);

@@ -177,3 +173,4 @@ return searchWords.filter(function (searchWord) {

.reduce(function (chunks, searchWord) {
searchWord = sanitizer(searchWord);
searchWord = sanitize(searchWord);
if (autoEscape) {

@@ -180,0 +177,0 @@ searchWord = escapeRegExpFn(searchWord);

{
"name": "highlight-words-core",
"description": "Utility functions shared by react-highlight-words and react-native-highlight-words",
"version": "1.0.1",
"version": "1.0.2",
"author": "Brian Vaughn <brian.david.vaughn@gmail.com>",

@@ -12,2 +12,3 @@ "license": "MIT",

"prebuild": "rimraf dist",
"prepublish": "npm run build",
"test": "mocha --compilers js:babel-register 'src/**/*.test.js'"

@@ -61,2 +62,3 @@ },

"expect.js": "^0.3.1",
"latinize": "^0.3.0",
"mocha": "^3.0.2",

@@ -63,0 +65,0 @@ "rimraf": "^2.4.3",

Sorry, the diff of this file is not supported yet

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