algoliasearch-helper
Advanced tools
Comparing version 2.6.0 to 2.6.1
{ | ||
"name": "algoliasearch-helper", | ||
"version": "2.6.0", | ||
"version": "2.6.1", | ||
"homepage": "https://github.com/algolia/algoliasearch-helper-js", | ||
@@ -5,0 +5,0 @@ "authors": [ |
{ | ||
"name": "algoliasearch-helper", | ||
"version": "2.6.0", | ||
"version": "2.6.1", | ||
"description": "Helper for implementing advanced search features with algolia", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -331,12 +331,3 @@ 'use strict'; | ||
AlgoliaSearchHelper.prototype.toggleRefinement = function(facet, value) { | ||
if (this.state.isHierarchicalFacet(facet)) { | ||
this.state = this.state.toggleHierarchicalFacetRefinement(facet, value); | ||
} else if (this.state.isConjunctiveFacet(facet)) { | ||
this.state = this.state.toggleFacetRefinement(facet, value); | ||
} else if (this.state.isDisjunctiveFacet(facet)) { | ||
this.state = this.state.toggleDisjunctiveFacetRefinement(facet, value); | ||
} else { | ||
throw new Error('Cannot refine the undeclared facet ' + facet + | ||
'; it should be added to the helper options facets, disjunctiveFacets or hierarchicalFacets'); | ||
} | ||
this.state = this.state.toggleRefinement(facet, value); | ||
@@ -343,0 +334,0 @@ this._change(); |
@@ -934,2 +934,22 @@ 'use strict'; | ||
/** | ||
* Generic toggle refinement method to use with facet, disjunctive facets | ||
* and hierarchical facets | ||
* @param {string} facet the facet to refine | ||
* @param {string} value the associated value | ||
* @return {SearchParameters} | ||
* @throws will throw an error if the facet is not declared in the settings of the helper | ||
*/ | ||
toggleRefinement: function toggleRefinement(facet, value) { | ||
if (this.isHierarchicalFacet(facet)) { | ||
return this.toggleHierarchicalFacetRefinement(facet, value); | ||
} else if (this.isConjunctiveFacet(facet)) { | ||
return this.toggleFacetRefinement(facet, value); | ||
} else if (this.isDisjunctiveFacet(facet)) { | ||
return this.toggleDisjunctiveFacetRefinement(facet, value); | ||
} | ||
throw new Error('Cannot refine the undeclared facet ' + facet + | ||
'; it should be added to the helper options facets, disjunctiveFacets or hierarchicalFacets'); | ||
}, | ||
/** | ||
* Switch the refinement applied over a facet/value | ||
@@ -936,0 +956,0 @@ * @method |
'use strict'; | ||
module.exports = '2.6.0'; | ||
module.exports = '2.6.1'; |
Sorry, the diff of this file is not supported yet
180553
3332