Socket
Socket
Sign inDemoInstall

fuzzysearch-highlight

Package Overview
Dependencies
0
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0 to 1.0.1

2

index.js

@@ -24,5 +24,3 @@ module.exports = function highlight (query, text, opts) {

if (!after) return null
return before + match + after
}

7

package.json
{
"name": "fuzzysearch-highlight",
"version": "1.0.0",
"version": "1.0.1",
"description": "Highlight fuzzy matched text",
"main": "index.js",
"scripts": {
"test": "node test.js"
"test": "standard && ava"
},

@@ -20,4 +20,5 @@ "repository": {

"devDependencies": {
"tape": "^4.0.0"
"ava": "^0.2.0",
"standard": "^5.2.2"
}
}

@@ -1,6 +0,6 @@

var test = require('tape')
var test = require('ava')
var highlight = require('./index.js')
test(function (t) {
t.equal(
test('match', function (t) {
t.is(
highlight('tqb', 'The quick brown fox'),

@@ -10,3 +10,3 @@ '<strong>T</strong>he <strong>q</strong>uick <strong>b</strong>rown fox'

t.equal(
t.is(
highlight('quick', 'The quick brown fox'),

@@ -16,9 +16,15 @@ 'The <strong>quick</strong> brown fox'

t.equal(
highlight('zzz', 'The quick brown fox'),
null,
'it returns null if unmatched'
)
t.is(highlight('fox', 'fox'), '<strong>fox</strong>')
t.is(highlight('ox', 'quick fox'), 'quick f<strong>ox</strong>')
t.equal(
t.end()
})
test('not match', function (t) {
t.is(highlight('zzz', 'The quick brown fox'), null)
t.end()
})
test('specify tag', function (t) {
t.is(
highlight('quick', 'The quick brown fox', { tag: 'em' }),

@@ -25,0 +31,0 @@ 'The <em>quick</em> brown fox'

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc