docsearch.js
Advanced tools
Comparing version
@@ -0,1 +1,7 @@ | ||
<a name="1.4.0"></a> | ||
# [1.4.0](https://github.com/algolia/docsearch/compare/v1.3.0...v1.4.0) (2016-12-13) | ||
<a name="1.3.0"></a> | ||
@@ -2,0 +8,0 @@ # [1.3.0](https://github.com/algolia/docsearch/compare/1.2.0...v1.3.0) (2016-06-12) |
@@ -210,6 +210,9 @@ 'use strict'; | ||
getHighlightedValue: function getHighlightedValue(object, property) { | ||
if (!object._highlightResult || !object._highlightResult[property] || !object._highlightResult[property].value) { | ||
return object[property]; | ||
if (object._highlightResult && object._highlightResult.hierarchy_camel && object._highlightResult.hierarchy_camel[property] && object._highlightResult.hierarchy_camel[property].matchLevel && object._highlightResult.hierarchy_camel[property].matchLevel !== 'none' && object._highlightResult.hierarchy_camel[property].value) { | ||
return object._highlightResult.hierarchy_camel[property].value; | ||
} | ||
return object._highlightResult[property].value; | ||
if (object._highlightResult && object._highlightResult && object._highlightResult[property] && object._highlightResult[property].value) { | ||
return object._highlightResult[property].value; | ||
} | ||
return object[property]; | ||
}, | ||
@@ -216,0 +219,0 @@ /* |
@@ -6,3 +6,3 @@ 'use strict'; | ||
}); | ||
exports['default'] = '1.3.0'; | ||
exports['default'] = '1.4.0'; | ||
module.exports = exports['default']; |
{ | ||
"name": "docsearch.js", | ||
"version": "1.3.0", | ||
"version": "1.4.0", | ||
"description": "Add an autocomplete dropdown to your documentation", | ||
@@ -5,0 +5,0 @@ "main": "dist/npm/index.js", |
@@ -198,8 +198,17 @@ import $ from 'npm-zepto'; | ||
getHighlightedValue(object, property) { | ||
if (!object._highlightResult | ||
|| !object._highlightResult[property] | ||
|| !object._highlightResult[property].value) { | ||
return object[property]; | ||
if (object._highlightResult | ||
&& object._highlightResult.hierarchy_camel | ||
&& object._highlightResult.hierarchy_camel[property] | ||
&& object._highlightResult.hierarchy_camel[property].matchLevel | ||
&& object._highlightResult.hierarchy_camel[property].matchLevel !== 'none' | ||
&& object._highlightResult.hierarchy_camel[property].value) { | ||
return object._highlightResult.hierarchy_camel[property].value; | ||
} | ||
return object._highlightResult[property].value; | ||
if (object._highlightResult | ||
&& object._highlightResult | ||
&& object._highlightResult[property] | ||
&& object._highlightResult[property].value) { | ||
return object._highlightResult[property].value; | ||
} | ||
return object[property]; | ||
}, | ||
@@ -206,0 +215,0 @@ /* |
@@ -1,1 +0,1 @@ | ||
export default '1.3.0'; | ||
export default '1.4.0'; |
@@ -625,2 +625,43 @@ /* eslint-env mocha */ | ||
}); | ||
it('should use highlighted camel if exists and matchLevel not none', () => { | ||
// Given | ||
let input = [{ | ||
hierarchy: { | ||
lvl0: 'Ruby', | ||
lvl1: 'API', | ||
lvl2: 'Foo', | ||
lvl3: null, | ||
lvl4: null, | ||
lvl5: null | ||
}, | ||
_highlightResult: { | ||
hierarchy_camel: { | ||
lvl0: { | ||
value: '<mark>Python</mark>', | ||
matchLevel: 'full' | ||
}, | ||
lvl1: { | ||
value: '<mark>API2</mark>', | ||
matchLevel: 'full' | ||
} | ||
}, | ||
hierarchy: { | ||
lvl0: { | ||
value: '<mark>Ruby</mark>' | ||
}, | ||
lvl1: { | ||
value: '<mark>API</mark>' | ||
} | ||
} | ||
} | ||
}]; | ||
// When | ||
let actual = DocSearch.formatHits(input); | ||
// Then | ||
expect(actual[0].category).toEqual('<mark>Python</mark>'); | ||
expect(actual[0].subcategory).toEqual('<mark>API2</mark>'); | ||
}); | ||
it('should use lvl2 as title', () => { | ||
@@ -627,0 +668,0 @@ // Given |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
8016023
40.95%286
37.5%17681
31.54%5
25%