algoliasearch-helper 3.13.3 → 3.13.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,18 +2,16 @@ _Coming from V1 (or js client v2)?_ Read the [migration guide](https://github.co
2
2
 
3
3
  _Coming from V2?_ Read the [migration guide](https://github.com/algolia/algoliasearch-helper-js/wiki/Migration-guide-:-V2-to-V3) to the new version of the Helper.
4
4
 
5
- **The JavaScript helper is an advanced library we provide to our users. If you are looking to build a complete search interface, we recommend you to use [instantsearch.js](https://community.algolia.com/instantsearch.js/). If you want to build an autocomplete menu, see [autocomplete.js](https://github.com/algolia/autocomplete.js).**
5
+ **The JavaScript helper is an advanced library we provide to our users. If you are looking to build a complete search interface, we recommend you to use [InstantSearch](https://www.algolia.com/doc/guides/building-search-ui/what-is-instantsearch/js/). If you want to build an autocomplete menu, see [Autocomplete](https://github.com/algolia/autocomplete).**
6
6
 
7
- # algoliasearch-helper-js
7
+ # algoliasearch-helper
8
8
 
9
- This module is the companion of the [algolia/algoliasearch-client-js](https://github.com/algolia/algoliasearch-client-js). It helps you keep track of the search parameters and provides a higher level API.
9
+ This module is the companion of the [algolia/algoliasearch-client-javascript](https://github.com/algolia/algoliasearch-client-javascript). It helps you keep track of the search parameters and provides a higher level API.
10
10
 
11
11
  [See the helper in action](https://community.algolia.com/algoliasearch-helper-js/)
12
12
 
13
- [![Version][version-svg]][package-url] [![Build Status][travis-svg]][travis-url] [![License][license-image]][license-url] [![Downloads][downloads-image]][downloads-url] [![jsDelivr Hits][jsdelivr-badge]][jsdelivr-hits]
13
+ [![Version][version-svg]][package-url] [![License][license-image]][license-url] [![Downloads][downloads-image]][downloads-url] [![jsDelivr Hits][jsdelivr-badge]][jsdelivr-hits]
14
14
 
15
- [travis-svg]: https://img.shields.io/travis/algolia/algoliasearch-helper-js/develop.svg?style=flat-square
16
- [travis-url]: https://travis-ci.org/algolia/algoliasearch-helper-js
17
15
  [license-image]: http://img.shields.io/badge/license-MIT-green.svg?style=flat-square
18
16
  [license-url]: LICENSE
19
17
  [downloads-image]: https://img.shields.io/npm/dm/algoliasearch-helper.svg?style=flat-square
@@ -26,6 +24,7 @@ This module is the companion of the [algolia/algoliasearch-client-js](https://gi
26
24
  <!-- START doctoc generated TOC please keep comment here to allow auto update -->
27
25
  <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
28
26
 
27
+
29
28
  - [Features](#features)
30
29
  - [Examples](#examples)
31
30
  - [Vanilla JavaScript](#vanilla-javascript)
@@ -1328,6 +1327,6 @@ Here is an example of a result object you get with the `result` event.
1328
1327
  }
1329
1328
  ```
1330
1329
 
1331
- # Browser support
1330
+ ## Browser support
1332
1331
 
1333
1332
  This project works on any [ES5](https://en.wikipedia.org/wiki/ECMAScript#5th_Edition) browser, basically >= IE9+.
@@ -1,77 +1,4 @@
1
- (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.algoliasearchHelper = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
2
- 'use strict';
3
-
4
- var AlgoliaSearchHelper = require('./src/algoliasearch.helper');
5
-
6
- var SearchParameters = require('./src/SearchParameters');
7
- var SearchResults = require('./src/SearchResults');
8
-
9
- /**
10
- * The algoliasearchHelper module is the function that will let its
11
- * contains everything needed to use the Algoliasearch
12
- * Helper. It is a also a function that instanciate the helper.
13
- * To use the helper, you also need the Algolia JS client v3.
14
- * @example
15
- * //using the UMD build
16
- * var client = algoliasearch('latency', '6be0576ff61c053d5f9a3225e2a90f76');
17
- * var helper = algoliasearchHelper(client, 'bestbuy', {
18
- * facets: ['shipping'],
19
- * disjunctiveFacets: ['category']
20
- * });
21
- * helper.on('result', function(event) {
22
- * console.log(event.results);
23
- * });
24
- * helper
25
- * .toggleFacetRefinement('category', 'Movies & TV Shows')
26
- * .toggleFacetRefinement('shipping', 'Free shipping')
27
- * .search();
28
- * @example
29
- * // The helper is an event emitter using the node API
30
- * helper.on('result', updateTheResults);
31
- * helper.once('result', updateTheResults);
32
- * helper.removeListener('result', updateTheResults);
33
- * helper.removeAllListeners('result');
34
- * @module algoliasearchHelper
35
- * @param {AlgoliaSearch} client an AlgoliaSearch client
36
- * @param {string} index the name of the index to query
37
- * @param {SearchParameters|object} opts an object defining the initial config of the search. It doesn't have to be a {SearchParameters}, just an object containing the properties you need from it.
38
- * @return {AlgoliaSearchHelper} The helper instance
39
- */
40
- function algoliasearchHelper(client, index, opts) {
41
- return new AlgoliaSearchHelper(client, index, opts);
42
- }
43
-
44
- /**
45
- * The version currently used
46
- * @member module:algoliasearchHelper.version
47
- * @type {number}
48
- */
49
- algoliasearchHelper.version = require('./src/version');
50
-
51
- /**
52
- * Constructor for the Helper.
53
- * @member module:algoliasearchHelper.AlgoliaSearchHelper
54
- * @type {AlgoliaSearchHelper}
55
- */
56
- algoliasearchHelper.AlgoliaSearchHelper = AlgoliaSearchHelper;
57
-
58
- /**
59
- * Constructor for the object containing all the parameters of the search.
60
- * @member module:algoliasearchHelper.SearchParameters
61
- * @type {SearchParameters}
62
- */
63
- algoliasearchHelper.SearchParameters = SearchParameters;
64
-
65
- /**
66
- * Constructor for the object containing the results of the search.
67
- * @member module:algoliasearchHelper.SearchResults
68
- * @type {SearchResults}
69
- */
70
- algoliasearchHelper.SearchResults = SearchResults;
71
-
72
- module.exports = algoliasearchHelper;
73
-
74
- },{"./src/SearchParameters":5,"./src/SearchResults":7,"./src/algoliasearch.helper":8,"./src/version":24}],2:[function(require,module,exports){
1
+ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.algoliasearchHelper = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
75
2
  // Copyright Joyent, Inc. and other Node contributors.
76
3
  //
77
4
  // Permission is hereby granted, free of charge, to any person obtaining a
@@ -375,7 +302,80 @@ function isUndefined(arg) {
375
302
  return arg === void 0;
376
303
  }
377
304
 
378
- },{}],3:[function(require,module,exports){
305
+ },{}],2:[function(require,module,exports){
306
+ 'use strict';
307
+
308
+ var AlgoliaSearchHelper = require('./src/algoliasearch.helper');
309
+
310
+ var SearchParameters = require('./src/SearchParameters');
311
+ var SearchResults = require('./src/SearchResults');
312
+
313
+ /**
314
+ * The algoliasearchHelper module is the function that will let its
315
+ * contains everything needed to use the Algoliasearch
316
+ * Helper. It is a also a function that instanciate the helper.
317
+ * To use the helper, you also need the Algolia JS client v3.
318
+ * @example
319
+ * //using the UMD build
320
+ * var client = algoliasearch('latency', '6be0576ff61c053d5f9a3225e2a90f76');
321
+ * var helper = algoliasearchHelper(client, 'bestbuy', {
322
+ * facets: ['shipping'],
323
+ * disjunctiveFacets: ['category']
324
+ * });
325
+ * helper.on('result', function(event) {
326
+ * console.log(event.results);
327
+ * });
328
+ * helper
329
+ * .toggleFacetRefinement('category', 'Movies & TV Shows')
330
+ * .toggleFacetRefinement('shipping', 'Free shipping')
331
+ * .search();
332
+ * @example
333
+ * // The helper is an event emitter using the node API
334
+ * helper.on('result', updateTheResults);
335
+ * helper.once('result', updateTheResults);
336
+ * helper.removeListener('result', updateTheResults);
337
+ * helper.removeAllListeners('result');
338
+ * @module algoliasearchHelper
339
+ * @param {AlgoliaSearch} client an AlgoliaSearch client
340
+ * @param {string} index the name of the index to query
341
+ * @param {SearchParameters|object} opts an object defining the initial config of the search. It doesn't have to be a {SearchParameters}, just an object containing the properties you need from it.
342
+ * @return {AlgoliaSearchHelper} The helper instance
343
+ */
344
+ function algoliasearchHelper(client, index, opts) {
345
+ return new AlgoliaSearchHelper(client, index, opts);
346
+ }
347
+
348
+ /**
349
+ * The version currently used
350
+ * @member module:algoliasearchHelper.version
351
+ * @type {number}
352
+ */
353
+ algoliasearchHelper.version = require('./src/version');
354
+
355
+ /**
356
+ * Constructor for the Helper.
357
+ * @member module:algoliasearchHelper.AlgoliaSearchHelper
358
+ * @type {AlgoliaSearchHelper}
359
+ */
360
+ algoliasearchHelper.AlgoliaSearchHelper = AlgoliaSearchHelper;
361
+
362
+ /**
363
+ * Constructor for the object containing all the parameters of the search.
364
+ * @member module:algoliasearchHelper.SearchParameters
365
+ * @type {SearchParameters}
366
+ */
367
+ algoliasearchHelper.SearchParameters = SearchParameters;
368
+
369
+ /**
370
+ * Constructor for the object containing the results of the search.
371
+ * @member module:algoliasearchHelper.SearchResults
372
+ * @type {SearchResults}
373
+ */
374
+ algoliasearchHelper.SearchResults = SearchResults;
375
+
376
+ module.exports = algoliasearchHelper;
377
+
378
+ },{"./src/SearchParameters":5,"./src/SearchResults":7,"./src/algoliasearch.helper":8,"./src/version":24}],3:[function(require,module,exports){
379
379
  'use strict';
380
380
 
381
381
  var EventEmitter = require('@algolia/events');
@@ -417,7 +417,7 @@ DerivedHelper.prototype.getModifiedState = function (parameters) {
417
417
 
418
418
  module.exports = DerivedHelper;
419
419
 
420
- },{"../functions/inherits":15,"@algolia/events":2}],4:[function(require,module,exports){
420
+ },{"../functions/inherits":15,"@algolia/events":1}],4:[function(require,module,exports){
421
421
  'use strict';
422
422
 
423
423
  /**
@@ -550,7 +550,7 @@ var lib = {
550
550
  if (facetList.length !== values.length) {
551
551
  hasChanged = true;
552
552
  }
553
- // eslint-disable-next-line no-param-reassign
553
+
554
554
  memo[key] = facetList;
555
555
 
556
556
  return memo;
@@ -1327,7 +1327,6 @@ SearchParameters.prototype = {
1327
1327
  operatorList[operator] = outValues;
1328
1328
  });
1329
1329
 
1330
- // eslint-disable-next-line no-param-reassign
1331
1330
  memo[key] = operatorList;
1332
1331
 
1333
1332
  return memo;
@@ -2149,7 +2148,6 @@ SearchParameters.prototype = {
2149
2148
  var self = this;
2150
2149
  var nextWithNumbers = SearchParameters._parseNumbers(params);
2151
2150
  var previousPlainObject = Object.keys(this).reduce(function (acc, key) {
2152
- // eslint-disable-next-line no-param-reassign
2153
2151
  acc[key] = self[key];
2154
2152
  return acc;
2155
2153
  }, {});
@@ -2166,7 +2164,6 @@ SearchParameters.prototype = {
2166
2164
  }
2167
2165
 
2168
2166
  if (isNextValueDefined) {
2169
- // eslint-disable-next-line no-param-reassign
2170
2167
  previous[key] = nextWithNumbers[key];
2171
2168
  }
2172
2169
 
@@ -2560,7 +2557,6 @@ function getIndices(attributes) {
2560
2557
 
2561
2558
  function assignFacetStats(dest, facetStats, key) {
2562
2559
  if (facetStats && facetStats[key]) {
2563
- // eslint-disable-next-line no-param-reassign
2564
2560
  dest.stats = facetStats[key];
2565
2561
  }
2566
2562
  }
@@ -3235,7 +3231,6 @@ function extractNormalizedFacetValues(results, attribute) {
3235
3231
  * @return {undefined} function mutates the item
3236
3232
  */
3237
3233
  function setIsRefined(item, currentRefinement, depth) {
3238
- // eslint-disable-next-line no-param-reassign
3239
3234
  item.isRefined = item.name === currentRefinement[depth];
3240
3235
  if (item.data) {
3241
3236
  item.data.forEach(function (child) {
@@ -3254,7 +3249,6 @@ function setIsRefined(item, currentRefinement, depth) {
3254
3249
  * @return {HierarchicalFacet|Array} sorted node
3255
3250
  */
3256
3251
  function recSort(sortFn, node, names, level) {
3257
- // eslint-disable-next-line no-param-reassign
3258
3252
  level = level || 0;
3259
3253
 
3260
3254
  if (Array.isArray(node)) {
@@ -3302,7 +3296,6 @@ function sortViaFacetOrdering(facetValues, facetOrdering) {
3302
3296
  * ['one', 'two'] -> { one: 0, two: 1 }
3303
3297
  */
3304
3298
  var reverseOrder = order.reduce(function (acc, name, i) {
3305
- // eslint-disable-next-line no-param-reassign
3306
3299
  acc[name] = i;
3307
3300
  return acc;
3308
3301
  }, {});
@@ -4050,13 +4043,10 @@ AlgoliaSearchHelper.prototype.searchForFacetValues = function (
4050
4043
  self._currentNbQueries--;
4051
4044
  if (self._currentNbQueries === 0) self.emit('searchQueueEmpty');
4052
4045
 
4053
- // eslint-disable-next-line no-param-reassign
4054
4046
  content = Array.isArray(content) ? content[0] : content;
4055
4047
 
4056
4048
  content.facetHits.forEach(function (f) {
4057
- // eslint-disable-next-line no-param-reassign
4058
4049
  f.escapedValue = escapeFacetValue(f.value);
4059
- // eslint-disable-next-line no-param-reassign
4060
4050
  f.isRefined = isDisjunctive
4061
4051
  ? state.isDisjunctiveFacetRefined(facet, f.escapedValue)
4062
4052
  : state.isFacetRefined(facet, f.escapedValue);
@@ -5245,7 +5235,7 @@ AlgoliaSearchHelper.prototype.hasPendingRequests = function () {
5245
5235
 
5246
5236
  module.exports = AlgoliaSearchHelper;
5247
5237
 
5248
- },{"./DerivedHelper":3,"./SearchParameters":5,"./SearchResults":7,"./functions/escapeFacetValue":11,"./functions/inherits":15,"./functions/merge":17,"./functions/objectHasKeys":18,"./functions/omit":19,"./requestBuilder":22,"./version":24,"@algolia/events":2}],9:[function(require,module,exports){
5238
+ },{"./DerivedHelper":3,"./SearchParameters":5,"./SearchResults":7,"./functions/escapeFacetValue":11,"./functions/inherits":15,"./functions/merge":17,"./functions/objectHasKeys":18,"./functions/omit":19,"./requestBuilder":22,"./version":24,"@algolia/events":1}],9:[function(require,module,exports){
5249
5239
  'use strict';
5250
5240
 
5251
5241
  module.exports = function compact(array) {
@@ -5271,10 +5261,8 @@ module.exports = function defaultsPure() {
5271
5261
  }
5272
5262
  if (acc[key] !== undefined) {
5273
5263
  // remove if already added, so that we can add it in correct order
5274
- // eslint-disable-next-line no-param-reassign
5275
5264
  delete acc[key];
5276
5265
  }
5277
- // eslint-disable-next-line no-param-reassign
5278
5266
  acc[key] = source[key];
5279
5267
  });
5280
5268
  return acc;
@@ -5393,7 +5381,6 @@ module.exports = function formatSort(sortBy, defaults) {
5393
5381
  'use strict';
5394
5382
 
5395
5383
  function inherits(ctor, superCtor) {
5396
- // eslint-disable-next-line no-param-reassign
5397
5384
  ctor.prototype = Object.create(superCtor.prototype, {
5398
5385
  constructor: {
5399
5386
  value: ctor,
@@ -5443,6 +5430,7 @@ function _merge(target, source) {
5443
5430
  return target;
5444
5431
  }
5445
5432
 
5433
+ // eslint-disable-next-line no-restricted-syntax
5446
5434
  for (var key in source) {
5447
5435
  if (
5448
5436
  !Object.prototype.hasOwnProperty.call(source, key) ||
@@ -5465,10 +5453,8 @@ function _merge(target, source) {
5465
5453
  isObjectOrArrayOrFunction(targetVal) &&
5466
5454
  isObjectOrArrayOrFunction(sourceVal)
5467
5455
  ) {
5468
- // eslint-disable-next-line no-param-reassign
5469
5456
  target[key] = _merge(targetVal, sourceVal);
5470
5457
  } else {
5471
- // eslint-disable-next-line no-param-reassign
5472
5458
  target[key] = clone(sourceVal);
5473
5459
  }
5474
5460
  }
@@ -5492,7 +5478,6 @@ function _merge(target, source) {
5492
5478
  */
5493
5479
  function merge(target) {
5494
5480
  if (!isObjectOrArrayOrFunction(target)) {
5495
- // eslint-disable-next-line no-param-reassign
5496
5481
  target = {};
5497
5482
  }
5498
5483
 
@@ -5579,7 +5564,6 @@ function orderBy(collection, iteratees, orders) {
5579
5564
  }
5580
5565
 
5581
5566
  if (!Array.isArray(orders)) {
5582
- // eslint-disable-next-line no-param-reassign
5583
5567
  orders = [];
5584
5568
  }
5585
5569
 
@@ -5651,7 +5635,6 @@ function sortObject(obj) {
5651
5635
  return a.localeCompare(b);
5652
5636
  })
5653
5637
  .reduce(function (acc, curr) {
5654
- // eslint-disable-next-line no-param-reassign
5655
5638
  acc[curr] = obj[curr];
5656
5639
  return acc;
5657
5640
  }, {});
@@ -6091,8 +6074,8 @@ module.exports = function isValidUserToken(userToken) {
6091
6074
  },{}],24:[function(require,module,exports){
6092
6075
  'use strict';
6093
6076
 
6094
- module.exports = '3.13.3';
6077
+ module.exports = '3.13.5';
6095
6078
 
6096
- },{}]},{},[1])(1)
6079
+ },{}]},{},[2])(2)
6097
6080
  });
6098
6081
  //# sourceMappingURL=algoliasearch.helper.js.map