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

js-solr-highlighter

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

js-solr-highlighter - npm Package Compare versions

Comparing version 0.7.2 to 0.7.3

26

index.test.js

@@ -537,3 +537,3 @@ import { isStopWord, highlightByQuery } from './index.js'

const content =
"Pediatric non-red cell blood product transfusion practices: what's the evidence to guide transfusion of the 'yellow' blood products?"
'Pediatric non-red cell blood product transfusion practices: what\'s the evidence to guide transfusion of the \'yellow\' blood products?'
const received = highlightByQuery(query, content, {

@@ -546,2 +546,26 @@ highlightAll: false

})
test('breast cancer', () => {
const query = 'breast cancer'
const content =
'Editorial: The Role of Breast Cancer Stem Cells in Clinical Outcomes.'
const received = highlightByQuery(query, content, {
highlightIdPattern: 'new-highlight-'
})
const expected =
'Editorial: The Role of <span id=\"new-highlight-0\" class=\"highlight\">Breast</span> <span id=\"new-highlight-1\" class=\"highlight\">Cancer</span> Stem Cells in Clinical Outcomes.'
expect(received).toBe(expected)
})
test('breast cancer', () => {
const query = 'breast cancer'
const content =
'Editorial: The Role of Breast Cancer Stem Cells in Clinical Outcomes.'
const received = highlightByQuery(query, content, {
highlightClass: 'new-highlight'
})
const expected =
'Editorial: The Role of <span id=\"highlight-0\" class=\"new-highlight\">Breast</span> <span id=\"highlight-1\" class=\"new-highlight\">Cancer</span> Stem Cells in Clinical Outcomes.'
expect(received).toBe(expected)
})
})

@@ -548,0 +572,0 @@

2

package.json
{
"name": "js-solr-highlighter",
"version": "0.7.2",
"version": "0.7.3",
"description": "A JavaScript library for highlighting HTML text based on the query in the lucene/solr query syntax",

@@ -5,0 +5,0 @@ "main": "build/index.js",

@@ -46,4 +46,4 @@ # js-solr-highlighter

| highlightAll | boolean | highlightAll indicates whether to highlight all occurances of the text or the first found occurance only.<br />If undefined, it is true. |
| highlightIdPattern | string | highlightIdPattern is the same pattern of the IDs associated with the highlights in the HTML.<br />A highlight ID consists of highlightIdPattern followed by the index of the highlight, such as "highlight-0", "highlight-1"...<br />If undefined, it is "highlight-" |
| highlightClass | string | highlightClass is the classname of every highlight in the HTML. If undefined, it is "highlight" |
| highlightIdPattern | string | highlightIdPattern is the same pattern of the IDs associated with the highlights in the HTML.<br />A highlight ID consists of highlightIdPattern followed by the index of the highlight, such as "highlight-0", "highlight-1"...<br />If undefined, it is "highlight-". |
| highlightClass | string | highlightClass is the classname of every highlight in the HTML.<br />If undefined, it is "highlight". |

@@ -50,0 +50,0 @@ ## Highlighting rules

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