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

@algolia/recommend-core

Package Overview
Dependencies
Maintainers
67
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@algolia/recommend-core - npm Package Compare versions

Comparing version 1.7.1 to 1.8.0

2

dist/esm/version.d.ts

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

export declare const version = "1.7.1";
export declare const version = "1.8.0";

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

export var version = '1.7.1';
export var version = '1.8.0';

@@ -1,3 +0,3 @@

/*! @algolia/recommend-core 1.7.1 | MIT License | © Algolia, Inc. and contributors | https://github.com/algolia/recommend */
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self)["@algolia/recommend-core"]={})}(this,(function(e){"use strict";function n(e){var n=e.hits,t=e.maxRecommendations,r=e.nrOfObjs,o={};n.forEach((function(e){e.forEach((function(e,n){o[e.objectID]?o[e.objectID]={indexSum:o[e.objectID].indexSum+n,nr:o[e.objectID].nr+1}:o[e.objectID]={indexSum:n,nr:1}}))}));var a=function(e,n){for(var t=[],r=0,o=Object.keys(e);r<o.length;r++){var a=o[r];e[a].nr<2&&(e[a].indexSum+=100),t.push({objectID:a,avgOfIndices:e[a].indexSum/n})}return t.sort((function(e,n){return e.avgOfIndices>n.avgOfIndices?1:-1}))}(o,r);return a.reduce((function(e,t){var r=n.flat().find((function(e){return e.objectID===t.objectID}));return r?e.concat(r):e}),[]).slice(0,t&&t>0?t:void 0)}function t(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function r(e){return function(e){if(Array.isArray(e))return t(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,n){if(e){if("string"==typeof e)return t(e,n);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?t(e,n):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(e){var n,t,o,a=e.hits,m=e.maxRecommendations;return(n=function(e,n){return(e._score||0)>(n._score||0)?-1:1},t=a,o=r(t),o.sort(n),o).slice(0,m&&m>0?m:void 0)}var a="1.7.1";e.getFrequentlyBoughtTogether=function(e){var t=e.objectIDs,r=e.recommendClient,o=e.transformItems,m=void 0===o?function(e){return e}:o,i=e.indexName,c=e.maxRecommendations,u=e.queryParameters,s=e.threshold,d=t.map((function(e){return{indexName:i,maxRecommendations:c,objectID:e,queryParameters:u,threshold:s}}));return r.addAlgoliaAgent("recommend-core",a),r.getFrequentlyBoughtTogether(d).then((function(e){return n({maxRecommendations:c,hits:e.results.map((function(e){return e.hits})),nrOfObjs:t.length})})).then((function(e){return{recommendations:m(e)}}))},e.getRecommendations=function(e){var t=e.objectIDs,r=e.recommendClient,o=e.transformItems,m=void 0===o?function(e){return e}:o,i=e.fallbackParameters,c=e.indexName,u=e.maxRecommendations,s=e.model,d=e.queryParameters,f=e.threshold,l=t.map((function(e){return{fallbackParameters:i,indexName:c,maxRecommendations:u,model:s,objectID:e,queryParameters:d,threshold:f}}));return r.addAlgoliaAgent("recommend-core",a),r.getRecommendations(l).then((function(e){return n({maxRecommendations:u,hits:e.results.map((function(e){return e.hits})),nrOfObjs:t.length})})).then((function(e){return{recommendations:m(e)}}))},e.getRelatedProducts=function(e){var t=e.objectIDs,r=e.recommendClient,o=e.transformItems,m=void 0===o?function(e){return e}:o,i=e.fallbackParameters,c=e.indexName,u=e.maxRecommendations,s=e.queryParameters,d=e.threshold,f=t.map((function(e){return{fallbackParameters:i,indexName:c,maxRecommendations:u,objectID:e,queryParameters:s,threshold:d}}));return r.addAlgoliaAgent("recommend-core",a),r.getRelatedProducts(f).then((function(e){return n({maxRecommendations:u,hits:e.results.map((function(e){return e.hits})),nrOfObjs:t.length})})).then((function(e){return{recommendations:m(e)}}))},e.getTrendingFacets=function(e){var n=e.recommendClient,t=e.transformItems,r=void 0===t?function(e){return e}:t,m=e.fallbackParameters,i=e.indexName,c=e.maxRecommendations,u=e.queryParameters,s=e.threshold,d=e.facetName,f={fallbackParameters:m,indexName:i,maxRecommendations:c,queryParameters:u,threshold:s,facetName:d};return n.addAlgoliaAgent("recommend-core",a),n.getTrendingFacets([f]).then((function(e){return o({maxRecommendations:c,hits:e.results.map((function(e){return e.hits})).flat()})})).then((function(e){return{recommendations:r(e)}}))},e.getTrendingItems=function(e){var n=e.recommendClient,t=e.transformItems,m=void 0===t?function(e){return e}:t,i=e.fallbackParameters,c=e.indexName,u=e.maxRecommendations,s=e.queryParameters,d=e.threshold,f=e.facetName,l=e.facetValue,h={fallbackParameters:i,indexName:c,maxRecommendations:u,queryParameters:s,threshold:d,facetName:f,facetValue:l};return n.addAlgoliaAgent("recommend-core",a),n.getTrendingItems([h]).then((function(e){return o({maxRecommendations:u,hits:(n="objectID",t=e.results.map((function(e){return e.hits})).flat(),r(new Map(t.map((function(e){return[e[n],e]}))).values()))});var n,t})).then((function(e){return{recommendations:m(e)}}))},Object.defineProperty(e,"__esModule",{value:!0})}));
/*! @algolia/recommend-core 1.8.0 | MIT License | © Algolia, Inc. and contributors | https://github.com/algolia/recommend */
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self)["@algolia/recommend-core"]={})}(this,(function(e){"use strict";function n(e){var n=e.hits,t=e.maxRecommendations,r=e.nrOfObjs,o={};n.forEach((function(e){e.forEach((function(e,n){o[e.objectID]?o[e.objectID]={indexSum:o[e.objectID].indexSum+n,nr:o[e.objectID].nr+1}:o[e.objectID]={indexSum:n,nr:1}}))}));var a=function(e,n){for(var t=[],r=0,o=Object.keys(e);r<o.length;r++){var a=o[r];e[a].nr<2&&(e[a].indexSum+=100),t.push({objectID:a,avgOfIndices:e[a].indexSum/n})}return t.sort((function(e,n){return e.avgOfIndices>n.avgOfIndices?1:-1}))}(o,r);return a.reduce((function(e,t){var r=n.flat().find((function(e){return e.objectID===t.objectID}));return r?e.concat(r):e}),[]).slice(0,t&&t>0?t:void 0)}function t(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function r(e){return function(e){if(Array.isArray(e))return t(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,n){if(e){if("string"==typeof e)return t(e,n);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?t(e,n):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(e){var n,t,o,a=e.hits,m=e.maxRecommendations;return(n=function(e,n){return(e._score||0)>(n._score||0)?-1:1},t=a,o=r(t),o.sort(n),o).slice(0,m&&m>0?m:void 0)}var a="1.8.0";e.getFrequentlyBoughtTogether=function(e){var t=e.objectIDs,r=e.recommendClient,o=e.transformItems,m=void 0===o?function(e){return e}:o,i=e.indexName,c=e.maxRecommendations,u=e.queryParameters,s=e.threshold,d=t.map((function(e){return{indexName:i,maxRecommendations:c,objectID:e,queryParameters:u,threshold:s}}));return r.addAlgoliaAgent("recommend-core",a),r.getFrequentlyBoughtTogether(d).then((function(e){return n({maxRecommendations:c,hits:e.results.map((function(e){return e.hits})),nrOfObjs:t.length})})).then((function(e){return{recommendations:m(e)}}))},e.getRecommendations=function(e){var t=e.objectIDs,r=e.recommendClient,o=e.transformItems,m=void 0===o?function(e){return e}:o,i=e.fallbackParameters,c=e.indexName,u=e.maxRecommendations,s=e.model,d=e.queryParameters,f=e.threshold,l=t.map((function(e){return{fallbackParameters:i,indexName:c,maxRecommendations:u,model:s,objectID:e,queryParameters:d,threshold:f}}));return r.addAlgoliaAgent("recommend-core",a),r.getRecommendations(l).then((function(e){return n({maxRecommendations:u,hits:e.results.map((function(e){return e.hits})),nrOfObjs:t.length})})).then((function(e){return{recommendations:m(e)}}))},e.getRelatedProducts=function(e){var t=e.objectIDs,r=e.recommendClient,o=e.transformItems,m=void 0===o?function(e){return e}:o,i=e.fallbackParameters,c=e.indexName,u=e.maxRecommendations,s=e.queryParameters,d=e.threshold,f=t.map((function(e){return{fallbackParameters:i,indexName:c,maxRecommendations:u,objectID:e,queryParameters:s,threshold:d}}));return r.addAlgoliaAgent("recommend-core",a),r.getRelatedProducts(f).then((function(e){return n({maxRecommendations:u,hits:e.results.map((function(e){return e.hits})),nrOfObjs:t.length})})).then((function(e){return{recommendations:m(e)}}))},e.getTrendingFacets=function(e){var n=e.recommendClient,t=e.transformItems,r=void 0===t?function(e){return e}:t,m=e.fallbackParameters,i=e.indexName,c=e.maxRecommendations,u=e.queryParameters,s=e.threshold,d=e.facetName,f={fallbackParameters:m,indexName:i,maxRecommendations:c,queryParameters:u,threshold:s,facetName:d};return n.addAlgoliaAgent("recommend-core",a),n.getTrendingFacets([f]).then((function(e){return o({maxRecommendations:c,hits:e.results.map((function(e){return e.hits})).flat()})})).then((function(e){return{recommendations:r(e)}}))},e.getTrendingItems=function(e){var n=e.recommendClient,t=e.transformItems,m=void 0===t?function(e){return e}:t,i=e.fallbackParameters,c=e.indexName,u=e.maxRecommendations,s=e.queryParameters,d=e.threshold,f=e.facetName,l=e.facetValue,h={fallbackParameters:i,indexName:c,maxRecommendations:u,queryParameters:s,threshold:d,facetName:f,facetValue:l};return n.addAlgoliaAgent("recommend-core",a),n.getTrendingItems([h]).then((function(e){return o({maxRecommendations:u,hits:(n="objectID",t=e.results.map((function(e){return e.hits})).flat(),r(new Map(t.map((function(e){return[e[n],e]}))).values()))});var n,t})).then((function(e){return{recommendations:m(e)}}))},Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=index.js.map
{
"name": "@algolia/recommend-core",
"version": "1.7.1",
"version": "1.8.0",
"license": "MIT",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/algolia/recommend",

Sorry, the diff of this file is not supported yet

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