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

addsearch-js-client

Package Overview
Dependencies
Maintainers
1
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

addsearch-js-client - npm Package Compare versions

Comparing version 0.4.3 to 0.5.0

src/indexingapi.js

6

dist/addsearch-js-client.min.js

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

/*! addsearch-js-client 0.4.3 */
window.AddSearchClient=function(t){var e={};function i(n){if(e[n])return e[n].exports;var s=e[n]={i:n,l:!1,exports:{}};return t[n].call(s.exports,s,s.exports,i),s.l=!0,s.exports}return i.m=t,i.c=e,i.d=function(t,e,n){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var s in t)i.d(n,s,function(e){return t[e]}.bind(null,s));return n},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=2)}([function(t,e,i){(function(e,i){
/*! addsearch-js-client 0.5.0 */
window.AddSearchClient=function(t){var e={};function s(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,s),i.l=!0,i.exports}return s.m=t,s.c=e,s.d=function(t,e,n){s.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},s.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},s.t=function(t,e){if(1&e&&(t=s(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(s.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)s.d(n,i,function(e){return t[e]}.bind(null,i));return n},s.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return s.d(e,"a",e),e},s.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},s.p="",s(s.s=4)}([function(t,e,s){(function(e,s){
/*!

@@ -9,2 +9,2 @@ * @overview es6-promise - a tiny implementation of Promises/A+.

* @version v4.2.8+1e68dce6
*/var n;n=function(){"use strict";function t(t){return"function"==typeof t}var n=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)},s=0,r=void 0,o=void 0,a=function(t,e){p[s]=t,p[s+1]=e,2===(s+=2)&&(o?o(g):w())},u="undefined"!=typeof window?window:void 0,c=u||{},h=c.MutationObserver||c.WebKitMutationObserver,l="undefined"==typeof self&&void 0!==e&&"[object process]"==={}.toString.call(e),f="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function d(){var t=setTimeout;return function(){return t(g,1)}}var p=new Array(1e3);function g(){for(var t=0;t<s;t+=2)(0,p[t])(p[t+1]),p[t]=void 0,p[t+1]=void 0;s=0}var y,m,v,b,w=void 0;function F(t,e){var i=this,n=new this.constructor(S);void 0===n[T]&&R(n);var s=i._state;if(s){var r=arguments[s-1];a((function(){return z(s,n,r,i._result)}))}else k(i,n,t,e);return n}function _(t){if(t&&"object"==typeof t&&t.constructor===this)return t;var e=new this(S);return x(e,t),e}l?w=function(){return e.nextTick(g)}:h?(m=0,v=new h(g),b=document.createTextNode(""),v.observe(b,{characterData:!0}),w=function(){b.data=m=++m%2}):f?((y=new MessageChannel).port1.onmessage=g,w=function(){return y.port2.postMessage(0)}):w=void 0===u?function(){try{var t=Function("return this")().require("vertx");return void 0!==(r=t.runOnLoop||t.runOnContext)?function(){r(g)}:d()}catch(t){return d()}}():d();var T=Math.random().toString(36).substring(2);function S(){}function A(e,i,n){i.constructor===e.constructor&&n===F&&i.constructor.resolve===_?function(t,e){1===e._state?E(t,e._result):2===e._state?P(t,e._result):k(e,void 0,(function(e){return x(t,e)}),(function(e){return P(t,e)}))}(e,i):void 0===n?E(e,i):t(n)?function(t,e,i){a((function(t){var n=!1,s=function(t,e,i,n){try{t.call(e,i,n)}catch(t){return t}}(i,e,(function(i){n||(n=!0,e!==i?x(t,i):E(t,i))}),(function(e){n||(n=!0,P(t,e))}),t._label);!n&&s&&(n=!0,P(t,s))}),t)}(e,i,n):E(e,i)}function x(t,e){if(t===e)P(t,new TypeError("You cannot resolve a promise with itself"));else if(s=typeof(n=e),null===n||"object"!==s&&"function"!==s)E(t,e);else{var i=void 0;try{i=e.then}catch(e){return void P(t,e)}A(t,e,i)}var n,s}function O(t){t._onerror&&t._onerror(t._result),j(t)}function E(t,e){void 0===t._state&&(t._result=e,t._state=1,0!==t._subscribers.length&&a(j,t))}function P(t,e){void 0===t._state&&(t._state=2,t._result=e,a(O,t))}function k(t,e,i,n){var s=t._subscribers,r=s.length;t._onerror=null,s[r]=e,s[r+1]=i,s[r+2]=n,0===r&&t._state&&a(j,t)}function j(t){var e=t._subscribers,i=t._state;if(0!==e.length){for(var n=void 0,s=void 0,r=t._result,o=0;o<e.length;o+=3)n=e[o],s=e[o+i],n?z(i,n,s,r):s(r);t._subscribers.length=0}}function z(e,i,n,s){var r=t(n),o=void 0,a=void 0,u=!0;if(r){try{o=n(s)}catch(t){u=!1,a=t}if(i===o)return void P(i,new TypeError("A promises callback cannot return that same promise."))}else o=s;void 0!==i._state||(r&&u?x(i,o):!1===u?P(i,a):1===e?E(i,o):2===e&&P(i,o))}var C=0;function R(t){t[T]=C++,t._state=void 0,t._result=void 0,t._subscribers=[]}var B=function(){function t(t,e){this._instanceConstructor=t,this.promise=new t(S),this.promise[T]||R(this.promise),n(e)?(this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0===this.length?E(this.promise,this._result):(this.length=this.length||0,this._enumerate(e),0===this._remaining&&E(this.promise,this._result))):P(this.promise,new Error("Array Methods must be provided an Array"))}return t.prototype._enumerate=function(t){for(var e=0;void 0===this._state&&e<t.length;e++)this._eachEntry(t[e],e)},t.prototype._eachEntry=function(t,e){var i=this._instanceConstructor,n=i.resolve;if(n===_){var s=void 0,r=void 0,o=!1;try{s=t.then}catch(t){o=!0,r=t}if(s===F&&void 0!==t._state)this._settledAt(t._state,e,t._result);else if("function"!=typeof s)this._remaining--,this._result[e]=t;else if(i===I){var a=new i(S);o?P(a,r):A(a,t,s),this._willSettleAt(a,e)}else this._willSettleAt(new i((function(e){return e(t)})),e)}else this._willSettleAt(n(t),e)},t.prototype._settledAt=function(t,e,i){var n=this.promise;void 0===n._state&&(this._remaining--,2===t?P(n,i):this._result[e]=i),0===this._remaining&&E(n,this._result)},t.prototype._willSettleAt=function(t,e){var i=this;k(t,void 0,(function(t){return i._settledAt(1,e,t)}),(function(t){return i._settledAt(2,e,t)}))},t}(),I=function(){function e(t){this[T]=C++,this._result=this._state=void 0,this._subscribers=[],S!==t&&("function"!=typeof t&&function(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}(),this instanceof e?function(t,e){try{e((function(e){x(t,e)}),(function(e){P(t,e)}))}catch(e){P(t,e)}}(this,t):function(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}())}return e.prototype.catch=function(t){return this.then(null,t)},e.prototype.finally=function(e){var i=this.constructor;return t(e)?this.then((function(t){return i.resolve(e()).then((function(){return t}))}),(function(t){return i.resolve(e()).then((function(){throw t}))})):this.then(e,e)},e}();return I.prototype.then=F,I.all=function(t){return new B(this,t).promise},I.race=function(t){var e=this;return n(t)?new e((function(i,n){for(var s=t.length,r=0;r<s;r++)e.resolve(t[r]).then(i,n)})):new e((function(t,e){return e(new TypeError("You must pass an array to race."))}))},I.resolve=_,I.reject=function(t){var e=new this(S);return P(e,t),e},I._setScheduler=function(t){o=t},I._setAsap=function(t){a=t},I._asap=a,I.polyfill=function(){var t=void 0;if(void 0!==i)t=i;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var e=t.Promise;if(e){var n=null;try{n=Object.prototype.toString.call(e.resolve())}catch(t){}if("[object Promise]"===n&&!e.cast)return}t.Promise=I},I.Promise=I,I},t.exports=n()}).call(this,i(4),i(5))},function(t,e,i){i(6),t.exports=self.fetch.bind(self)},function(t,e,i){"use strict";var n=i(3),s=i(7),r=i(8),o=i(9),a=i(10),u=200;t.exports=function(t){this.sitekey=t,this.settings=new r,this.sessionId=("a-"+1e8*Math.random()).substring(0,10),this.search=function(t,e){var i=null,s=null;if(t&&o.isFunction(e))i=t,s=e;else if(!e&&o.isFunction(t))i=this.settings.getSettings().keyword,s=t;else{if(!this.settings.getSettings().callback)throw"Illegal search parameters. Should be (keyword, callbackFunction) or (callbackFunction)";i=this.settings.getSettings().keyword,s=this.settings.getSettings().callback}this.settings.setCallback(s),this.settings.setKeyword(i),this.throttledSearchFetch||(this.throttledSearchFetch=a(u,n)),this.throttledSearchFetch(this.sitekey,"search",this.settings.getSettings(),s)},this.suggestions=function(t,e){if(!t||!e||!o.isFunction(e))throw"Illegal suggestions parameters. Should be (prefix, callbackFunction)";this.settings.setSuggestionsPrefix(t),this.throttledSuggestionsFetch||(this.throttledSuggestionsFetch=a(u,n)),this.throttledSuggestionsFetch(this.sitekey,"suggest",this.settings.getSettings(),e)},this.autocomplete=function(t,e,i){if(!(t&&e&&i&&o.isFunction(i)))throw"Illegal autocomplete parameters. Should be (field, prefix, callbackFunction)";this.settings.setAutocompleteParams(t,e),this.throttledAutocompleteFetch||(this.throttledAutocompleteFetch=a(u,n)),this.throttledAutocompleteFetch(this.sitekey,"autocomplete",this.settings.getSettings(),i)},this.getSettings=function(){return this.settings.getSettings()},this.setLanguage=function(t){this.settings.setLanguage(t)},this.setCategoryFilters=function(t){this.settings.setCategoryFilters(t)},this.addCustomFieldFilter=function(t,e){this.settings.addCustomFieldFilter(t,e)},this.removeCustomFieldFilter=function(t,e){this.settings.removeCustomFieldFilter(t,e)},this.setPriceRangeFilter=function(t,e){this.settings.setPriceRangeFilter(t,e)},this.setDateFilter=function(t,e){this.settings.setDateFilter(t,e)},this.setJWT=function(t){this.settings.setJWT(t)},this.setUserToken=function(t){this.settings.setUserToken(t)},this.setPaging=function(t,e,i,n){this.settings.setPaging(t,e,i,n)},this.nextPage=function(){this.settings.nextPage()},this.previousPage=function(){this.settings.previousPage()},this.setSuggestionsSize=function(t){this.settings.setSuggestionsSize(t)},this.setAutocompleteSize=function(t){this.settings.setAutocompleteSize(t)},this.addFacetField=function(t){this.settings.addFacetField(t)},this.addRangeFacet=function(t,e){this.settings.addRangeFacet(t,e)},this.addStatsField=function(t){this.settings.addStatsField(t)},this.setNumberOfFacets=function(t){this.settings.setNumberOfFacets(t)},this.setResultType=function(t){this.settings.setResultType(t)},this.setPersonalizationEvents=function(t){this.settings.setPersonalizationEvents(t)},this.setFilterObject=function(t){this.settings.setFilterObject(t)},this.setShuffleAndLimitTo=function(t){this.settings.setShuffleAndLimitTo(t)},this.setFuzzyMatch=function(t){this.settings.setFuzzyMatch(t)},this.setPostfixWildcard=function(t){this.settings.setPostfixWildcard(t)},this.setCollectAnalytics=function(t){this.settings.setCollectAnalytics(t)},this.setThrottleTime=function(t){u=t},this.setStatsSessionId=function(t){this.sessionId=t},this.getStatsSessionId=function(){return this.sessionId},this.sendStatsEvent=function(t,e,i){if("search"===t){i={action:"search",session:this.sessionId,keyword:e,numberOfResults:i.numberOfResults};s(this.sitekey,i)}else{if("click"!==t)throw"Illegal sendStatsEvent type parameters. Should be search or click)";i={action:"click",session:this.sessionId,keyword:e,docid:i.documentId,position:i.position};s(this.sitekey,i)}},this.searchResultClicked=function(t,e){this.sendStatsEvent("click",this.settings.getSettings().keyword,{documentId:t,position:e})}}},function(t,e,i){"use strict";i(0).polyfill(),i(1);t.exports=function t(e,i,n,s,r){var o=function(t,e){return t||!1===t?"&"+e+"="+t:""};if("search"===i||"suggest"===i||"autocomplete"===i){var a="",u="",c=null;if("search"===i){c=i,a=(a=n.keyword).replace(/ and /g," AND ").replace(/ or /g," OR ").replace(/ not /g," NOT "),a=encodeURIComponent(a);var h=n.fuzzy;if("retry"===h&&(h=!0===r),"search"===i){if(u=o(n.lang,"lang")+o(h,"fuzzy")+o(n.collectAnalytics,"collectAnalytics")+o(n.postfixWildcard,"postfixWildcard")+o(n.categories,"categories")+o(n.priceFromCents,"priceFromCents")+o(n.priceToCents,"priceToCents")+o(n.dateFrom,"dateFrom")+o(n.dateTo,"dateTo")+o(n.paging.page,"page")+o(n.paging.pageSize,"limit")+o(n.paging.sortBy,"sort")+o(n.paging.sortOrder,"order")+o(n.shuffleAndLimitTo,"shuffleAndLimitTo")+o(n.jwt,"jwt")+o(n.resultType,"resultType")+o(n.userToken,"userToken")+o(n.numFacets,"numFacets"),n.customFieldFilters)for(var l=0;l<n.customFieldFilters.length;l++)u=u+"&customField="+n.customFieldFilters[l];if(n.facetFields)for(l=0;l<n.facetFields.length;l++)u=u+"&facet="+n.facetFields[l];if(n.rangeFacets&&(u=u+"&rangeFacets="+JSON.stringify(n.rangeFacets)),n.statsFields)for(l=0;l<n.statsFields.length;l++)u=u+"&fieldStat="+n.statsFields[l];if(n.personalizationEvents&&Array.isArray(n.personalizationEvents))for(l=0;l<n.personalizationEvents.length;l++){var f=n.personalizationEvents[l],d=Object.keys(f);u=u+"&personalizationEvent="+encodeURIComponent(d+"="+f[d])}n.filterObject&&(u=u+"&filter="+JSON.stringify(n.filterObject))}}else"suggest"===i?(c=i,u=o(n.suggestionsSize,"size"),a=n.suggestionsPrefix):"autocomplete"===i&&(c="autocomplete/document-field",u=o(n.autocomplete.field,"source")+o(n.autocomplete.size,"size"),a=n.autocomplete.prefix);fetch("https://api.addsearch.com/v1/"+c+"/"+e+"?term="+a+u).then((function(t){return t.json()})).then((function(o){if("search"===i&&"retry"===n.fuzzy&&0===o.total_hits&&!0!==r)t(e,i,n,s,!0);else{if(!0===r){var a=n.paging.pageSize;o.total_hits>=a&&(o.total_hits=a)}s(o)}})).catch((function(t){console.log(t),s({error:{response:500,message:"invalid server response"}})}))}else s({error:{response:400,message:"invalid query type"}})}},function(t,e){var i,n,s=t.exports={};function r(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function a(t){if(i===setTimeout)return setTimeout(t,0);if((i===r||!i)&&setTimeout)return i=setTimeout,setTimeout(t,0);try{return i(t,0)}catch(e){try{return i.call(null,t,0)}catch(e){return i.call(this,t,0)}}}!function(){try{i="function"==typeof setTimeout?setTimeout:r}catch(t){i=r}try{n="function"==typeof clearTimeout?clearTimeout:o}catch(t){n=o}}();var u,c=[],h=!1,l=-1;function f(){h&&u&&(h=!1,u.length?c=u.concat(c):l=-1,c.length&&d())}function d(){if(!h){var t=a(f);h=!0;for(var e=c.length;e;){for(u=c,c=[];++l<e;)u&&u[l].run();l=-1,e=c.length}u=null,h=!1,function(t){if(n===clearTimeout)return clearTimeout(t);if((n===o||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(t);try{n(t)}catch(e){try{return n.call(null,t)}catch(e){return n.call(this,t)}}}(t)}}function p(t,e){this.fun=t,this.array=e}function g(){}s.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var i=1;i<arguments.length;i++)e[i-1]=arguments[i];c.push(new p(t,e)),1!==c.length||h||a(d)},p.prototype.run=function(){this.fun.apply(null,this.array)},s.title="browser",s.browser=!0,s.env={},s.argv=[],s.version="",s.versions={},s.on=g,s.addListener=g,s.once=g,s.off=g,s.removeListener=g,s.removeAllListeners=g,s.emit=g,s.prependListener=g,s.prependOnceListener=g,s.listeners=function(t){return[]},s.binding=function(t){throw new Error("process.binding is not supported")},s.cwd=function(){return"/"},s.chdir=function(t){throw new Error("process.chdir is not supported")},s.umask=function(){return 0}},function(t,e){var i;i=function(){return this}();try{i=i||new Function("return this")()}catch(t){"object"==typeof window&&(i=window)}t.exports=i},function(t,e,i){"use strict";i.r(e),i.d(e,"Headers",(function(){return d})),i.d(e,"Request",(function(){return w})),i.d(e,"Response",(function(){return _})),i.d(e,"DOMException",(function(){return S})),i.d(e,"fetch",(function(){return A}));var n="URLSearchParams"in self,s="Symbol"in self&&"iterator"in Symbol,r="FileReader"in self&&"Blob"in self&&function(){try{return new Blob,!0}catch(t){return!1}}(),o="FormData"in self,a="ArrayBuffer"in self;if(a)var u=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],c=ArrayBuffer.isView||function(t){return t&&u.indexOf(Object.prototype.toString.call(t))>-1};function h(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function l(t){return"string"!=typeof t&&(t=String(t)),t}function f(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return s&&(e[Symbol.iterator]=function(){return e}),e}function d(t){this.map={},t instanceof d?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function p(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function g(t){return new Promise((function(e,i){t.onload=function(){e(t.result)},t.onerror=function(){i(t.error)}}))}function y(t){var e=new FileReader,i=g(e);return e.readAsArrayBuffer(t),i}function m(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function v(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:r&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:o&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:n&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():a&&r&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=m(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):a&&(ArrayBuffer.prototype.isPrototypeOf(t)||c(t))?this._bodyArrayBuffer=m(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):n&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},r&&(this.blob=function(){var t=p(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?p(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(y)}),this.text=function(){var t,e,i,n=p(this);if(n)return n;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,i=g(e),e.readAsText(t),i;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),i=new Array(e.length),n=0;n<e.length;n++)i[n]=String.fromCharCode(e[n]);return i.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},o&&(this.formData=function(){return this.text().then(F)}),this.json=function(){return this.text().then(JSON.parse)},this}d.prototype.append=function(t,e){t=h(t),e=l(e);var i=this.map[t];this.map[t]=i?i+", "+e:e},d.prototype.delete=function(t){delete this.map[h(t)]},d.prototype.get=function(t){return t=h(t),this.has(t)?this.map[t]:null},d.prototype.has=function(t){return this.map.hasOwnProperty(h(t))},d.prototype.set=function(t,e){this.map[h(t)]=l(e)},d.prototype.forEach=function(t,e){for(var i in this.map)this.map.hasOwnProperty(i)&&t.call(e,this.map[i],i,this)},d.prototype.keys=function(){var t=[];return this.forEach((function(e,i){t.push(i)})),f(t)},d.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),f(t)},d.prototype.entries=function(){var t=[];return this.forEach((function(e,i){t.push([i,e])})),f(t)},s&&(d.prototype[Symbol.iterator]=d.prototype.entries);var b=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function w(t,e){var i,n,s=(e=e||{}).body;if(t instanceof w){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new d(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,s||null==t._bodyInit||(s=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new d(e.headers)),this.method=(i=e.method||this.method||"GET",n=i.toUpperCase(),b.indexOf(n)>-1?n:i),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&s)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(s)}function F(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var i=t.split("="),n=i.shift().replace(/\+/g," "),s=i.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(s))}})),e}function _(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new d(e.headers),this.url=e.url||"",this._initBody(t)}w.prototype.clone=function(){return new w(this,{body:this._bodyInit})},v.call(w.prototype),v.call(_.prototype),_.prototype.clone=function(){return new _(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new d(this.headers),url:this.url})},_.error=function(){var t=new _(null,{status:0,statusText:""});return t.type="error",t};var T=[301,302,303,307,308];_.redirect=function(t,e){if(-1===T.indexOf(e))throw new RangeError("Invalid status code");return new _(null,{status:e,headers:{location:t}})};var S=self.DOMException;try{new S}catch(t){(S=function(t,e){this.message=t,this.name=e;var i=Error(t);this.stack=i.stack}).prototype=Object.create(Error.prototype),S.prototype.constructor=S}function A(t,e){return new Promise((function(i,n){var s=new w(t,e);if(s.signal&&s.signal.aborted)return n(new S("Aborted","AbortError"));var o=new XMLHttpRequest;function a(){o.abort()}o.onload=function(){var t,e,n={status:o.status,statusText:o.statusText,headers:(t=o.getAllResponseHeaders()||"",e=new d,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var i=t.split(":"),n=i.shift().trim();if(n){var s=i.join(":").trim();e.append(n,s)}})),e)};n.url="responseURL"in o?o.responseURL:n.headers.get("X-Request-URL");var s="response"in o?o.response:o.responseText;i(new _(s,n))},o.onerror=function(){n(new TypeError("Network request failed"))},o.ontimeout=function(){n(new TypeError("Network request failed"))},o.onabort=function(){n(new S("Aborted","AbortError"))},o.open(s.method,s.url,!0),"include"===s.credentials?o.withCredentials=!0:"omit"===s.credentials&&(o.withCredentials=!1),"responseType"in o&&r&&(o.responseType="blob"),s.headers.forEach((function(t,e){o.setRequestHeader(e,t)})),s.signal&&(s.signal.addEventListener("abort",a),o.onreadystatechange=function(){4===o.readyState&&s.signal.removeEventListener("abort",a)}),o.send(void 0===s._bodyInit?null:s._bodyInit)}))}A.polyfill=!0,self.fetch||(self.fetch=A,self.Headers=d,self.Request=w,self.Response=_)},function(t,e,i){"use strict";i(0).polyfill(),i(1);t.exports=function(t,e){"undefined"!=typeof window&&window.navigator&&window.navigator.sendBeacon?navigator.sendBeacon("https://api.addsearch.com/v1/stats/"+t+"/",JSON.stringify(e)):fetch("https://api.addsearch.com/v1/stats/"+t+"/",{method:"POST",headers:{"Content-Type":"text/plain"},body:JSON.stringify(e)})}},function(t,e,i){"use strict";t.exports=function(){this.settings={keyword:"*",callback:null,fuzzy:"auto",paging:{page:1,pageSize:10,sortBy:"relevance",sortOrder:"desc"},customFieldFilters:[],userToken:null,suggestionsSize:10,facetFields:[],autocomplete:{size:10}},this.getSettings=function(){return this.settings},this.setKeyword=function(t){this.settings.keyword=t||"*"},this.setCallback=function(t){this.settings.callback=t},this.setSuggestionsPrefix=function(t){this.settings.suggestionsPrefix=t},this.setSuggestionsSize=function(t){this.settings.suggestionsSize=t},this.setAutocompleteSize=function(t){this.settings.autocomplete.size=t},this.setAutocompleteParams=function(t,e){this.settings.autocomplete.field=t,this.settings.autocomplete.prefix=e},this.setLanguage=function(t){if(t&&2!==t.length)throw'use 2-char language code (e.g. "en")';this.settings.lang=t},this.setFuzzyMatch=function(t){if(!0!==t&&!1!==t&&"auto"!==t&&"retry"!==t)throw"fuzzy matching can be true, false, 'auto', or 'retry'";this.settings.fuzzy=t},this.setPostfixWildcard=function(t){this.settings.postfixWildcard=t},this.setCollectAnalytics=function(t){this.settings.collectAnalytics=t},this.setCategoryFilters=function(t){this.settings.categories=t},this.setFilterObject=function(t){this.settings.filterObject=t},this.setPriceRangeFilter=function(t,e){this.settings.priceFromCents=t,this.settings.priceToCents=e},this.addCustomFieldFilter=function(t,e){var i=encodeURIComponent(t+"="+e);-1===this.settings.customFieldFilters.indexOf(i)&&this.settings.customFieldFilters.push(i)},this.removeCustomFieldFilter=function(t,e){var i=!1,n=encodeURIComponent(t+"="+e);e||(i=!0,n=encodeURIComponent(t+"="));for(var s=this.settings.customFieldFilters.length;s>0;s--){var r=this.settings.customFieldFilters[s-1];(i&&0===r.indexOf(n)||r===n)&&this.settings.customFieldFilters.splice(s-1,1)}},this.setDateFilter=function(t,e){this.settings.dateFrom=t,this.settings.dateTo=e},this.setKeyword=function(t){this.settings.keyword=t||"*"},this.setJWT=function(t){this.settings.jwt=t},this.setUserToken=function(t){this.settings.userToken=t},this.setPersonalizationEvents=function(t){this.settings.personalizationEvents=t},this.setResultType=function(t){this.settings.resultType=t},this.addFacetField=function(t){-1===this.settings.facetFields.indexOf(t)&&this.settings.facetFields.push(t)},this.addRangeFacet=function(t,e){this.settings.rangeFacets||(this.settings.rangeFacets=[]),this.settings.rangeFacets.push({field:t,ranges:e})},this.addStatsField=function(t){this.settings.statsFields||(this.settings.statsFields=[]),-1===this.settings.statsFields.indexOf(t)&&this.settings.statsFields.push(t)},this.setNumberOfFacets=function(t){this.settings.numFacets=t},this.setPaging=function(t,e,i,n){if(t<1)throw"page must be 1 or bigger";if(e<1||e>300)throw"pageSize must be 1-300";if("asc"!==n&&"desc"!==n)throw"sortOrder must be asc or desc";this.settings.paging.page=t,this.settings.paging.pageSize=e,this.settings.paging.sortBy=i,this.settings.paging.sortOrder=n},this.setShuffleAndLimitTo=function(t){this.settings.shuffleAndLimitTo=t},this.nextPage=function(){this.settings.paging.page=this.settings.paging.page+1},this.previousPage=function(){this.settings.paging.page>0&&(this.settings.paging.page=this.settings.paging.page-1)}}},function(t,e){t.exports={isFunction:function(t){return t&&"[object Function]"==={}.toString.call(t)}}},function(t,e){t.exports=function(t,e){var i,n=0;function s(){i&&clearTimeout(i)}return function(){var r=this,o=Date.now()-n,a=arguments;function u(){n=Date.now(),e.apply(r,a)}s(),o>t?u():i=setTimeout(u,t-o)}}}]);
*/var n;n=function(){"use strict";function t(t){return"function"==typeof t}var n=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)},i=0,r=void 0,o=void 0,a=function(t,e){p[i]=t,p[i+1]=e,2===(i+=2)&&(o?o(g):w())},u="undefined"!=typeof window?window:void 0,c=u||{},h=c.MutationObserver||c.WebKitMutationObserver,f="undefined"==typeof self&&void 0!==e&&"[object process]"==={}.toString.call(e),l="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function d(){var t=setTimeout;return function(){return t(g,1)}}var p=new Array(1e3);function g(){for(var t=0;t<i;t+=2)(0,p[t])(p[t+1]),p[t]=void 0,p[t+1]=void 0;i=0}var y,m,v,b,w=void 0;function F(t,e){var s=this,n=new this.constructor(S);void 0===n[_]&&C(n);var i=s._state;if(i){var r=arguments[i-1];a((function(){return z(i,n,r,s._result)}))}else k(s,n,t,e);return n}function T(t){if(t&&"object"==typeof t&&t.constructor===this)return t;var e=new this(S);return A(e,t),e}f?w=function(){return e.nextTick(g)}:h?(m=0,v=new h(g),b=document.createTextNode(""),v.observe(b,{characterData:!0}),w=function(){b.data=m=++m%2}):l?((y=new MessageChannel).port1.onmessage=g,w=function(){return y.port2.postMessage(0)}):w=void 0===u?function(){try{var t=Function("return this")().require("vertx");return void 0!==(r=t.runOnLoop||t.runOnContext)?function(){r(g)}:d()}catch(t){return d()}}():d();var _=Math.random().toString(36).substring(2);function S(){}function x(e,s,n){s.constructor===e.constructor&&n===F&&s.constructor.resolve===T?function(t,e){1===e._state?O(t,e._result):2===e._state?P(t,e._result):k(e,void 0,(function(e){return A(t,e)}),(function(e){return P(t,e)}))}(e,s):void 0===n?O(e,s):t(n)?function(t,e,s){a((function(t){var n=!1,i=function(t,e,s,n){try{t.call(e,s,n)}catch(t){return t}}(s,e,(function(s){n||(n=!0,e!==s?A(t,s):O(t,s))}),(function(e){n||(n=!0,P(t,e))}),t._label);!n&&i&&(n=!0,P(t,i))}),t)}(e,s,n):O(e,s)}function A(t,e){if(t===e)P(t,new TypeError("You cannot resolve a promise with itself"));else if(i=typeof(n=e),null===n||"object"!==i&&"function"!==i)O(t,e);else{var s=void 0;try{s=e.then}catch(e){return void P(t,e)}x(t,e,s)}var n,i}function E(t){t._onerror&&t._onerror(t._result),j(t)}function O(t,e){void 0===t._state&&(t._result=e,t._state=1,0!==t._subscribers.length&&a(j,t))}function P(t,e){void 0===t._state&&(t._state=2,t._result=e,a(E,t))}function k(t,e,s,n){var i=t._subscribers,r=i.length;t._onerror=null,i[r]=e,i[r+1]=s,i[r+2]=n,0===r&&t._state&&a(j,t)}function j(t){var e=t._subscribers,s=t._state;if(0!==e.length){for(var n=void 0,i=void 0,r=t._result,o=0;o<e.length;o+=3)n=e[o],i=e[o+s],n?z(s,n,i,r):i(r);t._subscribers.length=0}}function z(e,s,n,i){var r=t(n),o=void 0,a=void 0,u=!0;if(r){try{o=n(i)}catch(t){u=!1,a=t}if(s===o)return void P(s,new TypeError("A promises callback cannot return that same promise."))}else o=i;void 0!==s._state||(r&&u?A(s,o):!1===u?P(s,a):1===e?O(s,o):2===e&&P(s,o))}var B=0;function C(t){t[_]=B++,t._state=void 0,t._result=void 0,t._subscribers=[]}var D=function(){function t(t,e){this._instanceConstructor=t,this.promise=new t(S),this.promise[_]||C(this.promise),n(e)?(this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0===this.length?O(this.promise,this._result):(this.length=this.length||0,this._enumerate(e),0===this._remaining&&O(this.promise,this._result))):P(this.promise,new Error("Array Methods must be provided an Array"))}return t.prototype._enumerate=function(t){for(var e=0;void 0===this._state&&e<t.length;e++)this._eachEntry(t[e],e)},t.prototype._eachEntry=function(t,e){var s=this._instanceConstructor,n=s.resolve;if(n===T){var i=void 0,r=void 0,o=!1;try{i=t.then}catch(t){o=!0,r=t}if(i===F&&void 0!==t._state)this._settledAt(t._state,e,t._result);else if("function"!=typeof i)this._remaining--,this._result[e]=t;else if(s===R){var a=new s(S);o?P(a,r):x(a,t,i),this._willSettleAt(a,e)}else this._willSettleAt(new s((function(e){return e(t)})),e)}else this._willSettleAt(n(t),e)},t.prototype._settledAt=function(t,e,s){var n=this.promise;void 0===n._state&&(this._remaining--,2===t?P(n,s):this._result[e]=s),0===this._remaining&&O(n,this._result)},t.prototype._willSettleAt=function(t,e){var s=this;k(t,void 0,(function(t){return s._settledAt(1,e,t)}),(function(t){return s._settledAt(2,e,t)}))},t}(),R=function(){function e(t){this[_]=B++,this._result=this._state=void 0,this._subscribers=[],S!==t&&("function"!=typeof t&&function(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}(),this instanceof e?function(t,e){try{e((function(e){A(t,e)}),(function(e){P(t,e)}))}catch(e){P(t,e)}}(this,t):function(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}())}return e.prototype.catch=function(t){return this.then(null,t)},e.prototype.finally=function(e){var s=this.constructor;return t(e)?this.then((function(t){return s.resolve(e()).then((function(){return t}))}),(function(t){return s.resolve(e()).then((function(){throw t}))})):this.then(e,e)},e}();return R.prototype.then=F,R.all=function(t){return new D(this,t).promise},R.race=function(t){var e=this;return n(t)?new e((function(s,n){for(var i=t.length,r=0;r<i;r++)e.resolve(t[r]).then(s,n)})):new e((function(t,e){return e(new TypeError("You must pass an array to race."))}))},R.resolve=T,R.reject=function(t){var e=new this(S);return P(e,t),e},R._setScheduler=function(t){o=t},R._setAsap=function(t){a=t},R._asap=a,R.polyfill=function(){var t=void 0;if(void 0!==s)t=s;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var e=t.Promise;if(e){var n=null;try{n=Object.prototype.toString.call(e.resolve())}catch(t){}if("[object Promise]"===n&&!e.cast)return}t.Promise=R},R.Promise=R,R},t.exports=n()}).call(this,s(6),s(2))},function(t,e,s){s(7),t.exports=self.fetch.bind(self)},function(t,e){var s;s=function(){return this}();try{s=s||new Function("return this")()}catch(t){"object"==typeof window&&(s=window)}t.exports=s},function(t,e,s){(function(e){t.exports={isFunction:function(t){return t&&"[object Function]"==={}.toString.call(t)},base64:function(t){return e.window={},window&&window.btoa?window.btoa(t):Buffer?Buffer.from(t).toString("base64"):void 0}}}).call(this,s(2))},function(t,e,s){"use strict";var n=s(5),i=s(8),r=s(9),o=s(10),a=s(3),u=s(11),c=200;t.exports=function(t,e){this.sitekey=t,this.privatekey=e,this.settings=new o,this.sessionId=("a-"+1e8*Math.random()).substring(0,10),this.search=function(t,e){var s=null,i=null;if(t&&a.isFunction(e))s=t,i=e;else if(!e&&a.isFunction(t))s=this.settings.getSettings().keyword,i=t;else{if(!this.settings.getSettings().callback)throw"Illegal search parameters. Should be (keyword, callbackFunction) or (callbackFunction)";s=this.settings.getSettings().keyword,i=this.settings.getSettings().callback}this.settings.setCallback(i),this.settings.setKeyword(s),this.throttledSearchFetch||(this.throttledSearchFetch=u(c,n)),this.throttledSearchFetch(this.sitekey,"search",this.settings.getSettings(),i)},this.suggestions=function(t,e){if(!t||!e||!a.isFunction(e))throw"Illegal suggestions parameters. Should be (prefix, callbackFunction)";this.settings.setSuggestionsPrefix(t),this.throttledSuggestionsFetch||(this.throttledSuggestionsFetch=u(c,n)),this.throttledSuggestionsFetch(this.sitekey,"suggest",this.settings.getSettings(),e)},this.autocomplete=function(t,e,s){if(!(t&&e&&s&&a.isFunction(s)))throw"Illegal autocomplete parameters. Should be (field, prefix, callbackFunction)";this.settings.setAutocompleteParams(t,e),this.throttledAutocompleteFetch||(this.throttledAutocompleteFetch=u(c,n)),this.throttledAutocompleteFetch(this.sitekey,"autocomplete",this.settings.getSettings(),s)},this.getDocument=function(t){return i.getDocument(this.sitekey,this.privatekey,t)},this.saveDocument=function(t){return i.saveDocument(this.sitekey,this.privatekey,t)},this.saveDocumentsBatch=function(t){if(!t||!t.documents||!Array.isArray(t.documents))throw"Please provide an array of documents: {documents: []}";return i.saveDocumentsBatch(this.sitekey,this.privatekey,t)},this.deleteDocument=function(t){return i.deleteDocument(this.sitekey,this.privatekey,t)},this.deleteDocumentsBatch=function(t){if(!t||!t.documents||!Array.isArray(t.documents))throw"Please provide an array of document ids: {documents: []}";return i.deleteDocumentsBatch(this.sitekey,this.privatekey,t)},this.getSettings=function(){return this.settings.getSettings()},this.setLanguage=function(t){this.settings.setLanguage(t)},this.setCategoryFilters=function(t){this.settings.setCategoryFilters(t)},this.addCustomFieldFilter=function(t,e){this.settings.addCustomFieldFilter(t,e)},this.removeCustomFieldFilter=function(t,e){this.settings.removeCustomFieldFilter(t,e)},this.setPriceRangeFilter=function(t,e){this.settings.setPriceRangeFilter(t,e)},this.setDateFilter=function(t,e){this.settings.setDateFilter(t,e)},this.setJWT=function(t){this.settings.setJWT(t)},this.setUserToken=function(t){this.settings.setUserToken(t)},this.setPaging=function(t,e,s,n){this.settings.setPaging(t,e,s,n)},this.nextPage=function(){this.settings.nextPage()},this.previousPage=function(){this.settings.previousPage()},this.setSuggestionsSize=function(t){this.settings.setSuggestionsSize(t)},this.setAutocompleteSize=function(t){this.settings.setAutocompleteSize(t)},this.addFacetField=function(t){this.settings.addFacetField(t)},this.addRangeFacet=function(t,e){this.settings.addRangeFacet(t,e)},this.addStatsField=function(t){this.settings.addStatsField(t)},this.setNumberOfFacets=function(t){this.settings.setNumberOfFacets(t)},this.setResultType=function(t){this.settings.setResultType(t)},this.setPersonalizationEvents=function(t){this.settings.setPersonalizationEvents(t)},this.setFilterObject=function(t){this.settings.setFilterObject(t)},this.setShuffleAndLimitTo=function(t){this.settings.setShuffleAndLimitTo(t)},this.setFuzzyMatch=function(t){this.settings.setFuzzyMatch(t)},this.setPostfixWildcard=function(t){this.settings.setPostfixWildcard(t)},this.setCollectAnalytics=function(t){this.settings.setCollectAnalytics(t)},this.setThrottleTime=function(t){c=t},this.setStatsSessionId=function(t){this.sessionId=t},this.getStatsSessionId=function(){return this.sessionId},this.sendStatsEvent=function(t,e,s){if("search"===t){s={action:"search",session:this.sessionId,keyword:e,numberOfResults:s.numberOfResults};r(this.sitekey,s)}else{if("click"!==t)throw"Illegal sendStatsEvent type parameters. Should be search or click)";s={action:"click",session:this.sessionId,keyword:e,docid:s.documentId,position:s.position};r(this.sitekey,s)}},this.searchResultClicked=function(t,e){this.sendStatsEvent("click",this.settings.getSettings().keyword,{documentId:t,position:e})}}},function(t,e,s){"use strict";s(0).polyfill(),s(1);t.exports=function t(e,s,n,i,r){var o=function(t,e){return t||!1===t?"&"+e+"="+t:""};if("search"===s||"suggest"===s||"autocomplete"===s){var a="",u="",c=null;if("search"===s){c=s,a=(a=n.keyword).replace(/ and /g," AND ").replace(/ or /g," OR ").replace(/ not /g," NOT "),a=encodeURIComponent(a);var h=n.fuzzy;if("retry"===h&&(h=!0===r),"search"===s){if(u=o(n.lang,"lang")+o(h,"fuzzy")+o(n.collectAnalytics,"collectAnalytics")+o(n.postfixWildcard,"postfixWildcard")+o(n.categories,"categories")+o(n.priceFromCents,"priceFromCents")+o(n.priceToCents,"priceToCents")+o(n.dateFrom,"dateFrom")+o(n.dateTo,"dateTo")+o(n.paging.page,"page")+o(n.paging.pageSize,"limit")+o(n.paging.sortBy,"sort")+o(n.paging.sortOrder,"order")+o(n.shuffleAndLimitTo,"shuffleAndLimitTo")+o(n.jwt,"jwt")+o(n.resultType,"resultType")+o(n.userToken,"userToken")+o(n.numFacets,"numFacets"),n.customFieldFilters)for(var f=0;f<n.customFieldFilters.length;f++)u=u+"&customField="+n.customFieldFilters[f];if(n.facetFields)for(f=0;f<n.facetFields.length;f++)u=u+"&facet="+n.facetFields[f];if(n.rangeFacets&&(u=u+"&rangeFacets="+JSON.stringify(n.rangeFacets)),n.statsFields)for(f=0;f<n.statsFields.length;f++)u=u+"&fieldStat="+n.statsFields[f];if(n.personalizationEvents&&Array.isArray(n.personalizationEvents))for(f=0;f<n.personalizationEvents.length;f++){var l=n.personalizationEvents[f],d=Object.keys(l);u=u+"&personalizationEvent="+encodeURIComponent(d+"="+l[d])}n.filterObject&&(u=u+"&filter="+JSON.stringify(n.filterObject))}}else"suggest"===s?(c=s,u=o(n.suggestionsSize,"size"),a=n.suggestionsPrefix):"autocomplete"===s&&(c="autocomplete/document-field",u=o(n.autocomplete.field,"source")+o(n.autocomplete.size,"size"),a=n.autocomplete.prefix);fetch("https://api.addsearch.com/v1/"+c+"/"+e+"?term="+a+u).then((function(t){return t.json()})).then((function(o){if("search"===s&&"retry"===n.fuzzy&&0===o.total_hits&&!0!==r)t(e,s,n,i,!0);else{if(!0===r){var a=n.paging.pageSize;o.total_hits>=a&&(o.total_hits=a)}i(o)}})).catch((function(t){console.log(t),i({error:{response:500,message:"invalid server response"}})}))}else i({error:{response:400,message:"invalid query type"}})}},function(t,e){var s,n,i=t.exports={};function r(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function a(t){if(s===setTimeout)return setTimeout(t,0);if((s===r||!s)&&setTimeout)return s=setTimeout,setTimeout(t,0);try{return s(t,0)}catch(e){try{return s.call(null,t,0)}catch(e){return s.call(this,t,0)}}}!function(){try{s="function"==typeof setTimeout?setTimeout:r}catch(t){s=r}try{n="function"==typeof clearTimeout?clearTimeout:o}catch(t){n=o}}();var u,c=[],h=!1,f=-1;function l(){h&&u&&(h=!1,u.length?c=u.concat(c):f=-1,c.length&&d())}function d(){if(!h){var t=a(l);h=!0;for(var e=c.length;e;){for(u=c,c=[];++f<e;)u&&u[f].run();f=-1,e=c.length}u=null,h=!1,function(t){if(n===clearTimeout)return clearTimeout(t);if((n===o||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(t);try{n(t)}catch(e){try{return n.call(null,t)}catch(e){return n.call(this,t)}}}(t)}}function p(t,e){this.fun=t,this.array=e}function g(){}i.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var s=1;s<arguments.length;s++)e[s-1]=arguments[s];c.push(new p(t,e)),1!==c.length||h||a(d)},p.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=g,i.addListener=g,i.once=g,i.off=g,i.removeListener=g,i.removeAllListeners=g,i.emit=g,i.prependListener=g,i.prependOnceListener=g,i.listeners=function(t){return[]},i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(t,e,s){"use strict";s.r(e),s.d(e,"Headers",(function(){return d})),s.d(e,"Request",(function(){return w})),s.d(e,"Response",(function(){return T})),s.d(e,"DOMException",(function(){return S})),s.d(e,"fetch",(function(){return x}));var n="URLSearchParams"in self,i="Symbol"in self&&"iterator"in Symbol,r="FileReader"in self&&"Blob"in self&&function(){try{return new Blob,!0}catch(t){return!1}}(),o="FormData"in self,a="ArrayBuffer"in self;if(a)var u=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],c=ArrayBuffer.isView||function(t){return t&&u.indexOf(Object.prototype.toString.call(t))>-1};function h(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function f(t){return"string"!=typeof t&&(t=String(t)),t}function l(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return i&&(e[Symbol.iterator]=function(){return e}),e}function d(t){this.map={},t instanceof d?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function p(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function g(t){return new Promise((function(e,s){t.onload=function(){e(t.result)},t.onerror=function(){s(t.error)}}))}function y(t){var e=new FileReader,s=g(e);return e.readAsArrayBuffer(t),s}function m(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function v(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:r&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:o&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:n&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():a&&r&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=m(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):a&&(ArrayBuffer.prototype.isPrototypeOf(t)||c(t))?this._bodyArrayBuffer=m(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):n&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},r&&(this.blob=function(){var t=p(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?p(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(y)}),this.text=function(){var t,e,s,n=p(this);if(n)return n;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,s=g(e),e.readAsText(t),s;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),s=new Array(e.length),n=0;n<e.length;n++)s[n]=String.fromCharCode(e[n]);return s.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},o&&(this.formData=function(){return this.text().then(F)}),this.json=function(){return this.text().then(JSON.parse)},this}d.prototype.append=function(t,e){t=h(t),e=f(e);var s=this.map[t];this.map[t]=s?s+", "+e:e},d.prototype.delete=function(t){delete this.map[h(t)]},d.prototype.get=function(t){return t=h(t),this.has(t)?this.map[t]:null},d.prototype.has=function(t){return this.map.hasOwnProperty(h(t))},d.prototype.set=function(t,e){this.map[h(t)]=f(e)},d.prototype.forEach=function(t,e){for(var s in this.map)this.map.hasOwnProperty(s)&&t.call(e,this.map[s],s,this)},d.prototype.keys=function(){var t=[];return this.forEach((function(e,s){t.push(s)})),l(t)},d.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),l(t)},d.prototype.entries=function(){var t=[];return this.forEach((function(e,s){t.push([s,e])})),l(t)},i&&(d.prototype[Symbol.iterator]=d.prototype.entries);var b=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function w(t,e){var s,n,i=(e=e||{}).body;if(t instanceof w){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new d(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,i||null==t._bodyInit||(i=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new d(e.headers)),this.method=(s=e.method||this.method||"GET",n=s.toUpperCase(),b.indexOf(n)>-1?n:s),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(i)}function F(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var s=t.split("="),n=s.shift().replace(/\+/g," "),i=s.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(i))}})),e}function T(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new d(e.headers),this.url=e.url||"",this._initBody(t)}w.prototype.clone=function(){return new w(this,{body:this._bodyInit})},v.call(w.prototype),v.call(T.prototype),T.prototype.clone=function(){return new T(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new d(this.headers),url:this.url})},T.error=function(){var t=new T(null,{status:0,statusText:""});return t.type="error",t};var _=[301,302,303,307,308];T.redirect=function(t,e){if(-1===_.indexOf(e))throw new RangeError("Invalid status code");return new T(null,{status:e,headers:{location:t}})};var S=self.DOMException;try{new S}catch(t){(S=function(t,e){this.message=t,this.name=e;var s=Error(t);this.stack=s.stack}).prototype=Object.create(Error.prototype),S.prototype.constructor=S}function x(t,e){return new Promise((function(s,n){var i=new w(t,e);if(i.signal&&i.signal.aborted)return n(new S("Aborted","AbortError"));var o=new XMLHttpRequest;function a(){o.abort()}o.onload=function(){var t,e,n={status:o.status,statusText:o.statusText,headers:(t=o.getAllResponseHeaders()||"",e=new d,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var s=t.split(":"),n=s.shift().trim();if(n){var i=s.join(":").trim();e.append(n,i)}})),e)};n.url="responseURL"in o?o.responseURL:n.headers.get("X-Request-URL");var i="response"in o?o.response:o.responseText;s(new T(i,n))},o.onerror=function(){n(new TypeError("Network request failed"))},o.ontimeout=function(){n(new TypeError("Network request failed"))},o.onabort=function(){n(new S("Aborted","AbortError"))},o.open(i.method,i.url,!0),"include"===i.credentials?o.withCredentials=!0:"omit"===i.credentials&&(o.withCredentials=!1),"responseType"in o&&r&&(o.responseType="blob"),i.headers.forEach((function(t,e){o.setRequestHeader(e,t)})),i.signal&&(i.signal.addEventListener("abort",a),o.onreadystatechange=function(){4===o.readyState&&i.signal.removeEventListener("abort",a)}),o.send(void 0===i._bodyInit?null:i._bodyInit)}))}x.polyfill=!0,self.fetch||(self.fetch=x,self.Headers=d,self.Request=w,self.Response=T)},function(t,e,s){"use strict";s(1);var n=s(3),i=s(0).Promise,r="https://api.addsearch.com/v2/indices/",o=function(t,e){return{Authorization:"Basic "+n.base64(t+":"+e),"Content-Type":"application/json"}};t.exports={getDocument:function(t,e,s){return new i((function(n,i){fetch(r+t+"/documents/"+s,{method:"GET",headers:o(t,e)}).then((function(t){200==t.status?n(t.json()):i({status:t.status,text:t.statusText})})).catch((function(t){i({status:400,text:t})}))}))},saveDocument:function(t,e,s){var n=s.id||s.url;return new i((function(i,a){fetch(r+t+"/documents/",{method:n?"PUT":"POST",headers:o(t,e),body:JSON.stringify(s)}).then((function(t){202==t.status?i({status:t.status,text:t.statusText}):a({status:t.status,text:t.statusText})})).catch((function(t){a({status:400,text:t})}))}))},saveDocumentsBatch:function(t,e,s){return new i((function(n,i){fetch(r+t+"/documents:batch",{method:"PUT",headers:o(t,e),body:JSON.stringify(s)}).then((function(t){202==t.status?n({status:t.status,text:t.statusText}):i({status:t.status,text:t.statusText})})).catch((function(t){i({status:400,text:t})}))}))},deleteDocument:function(t,e,s){return new i((function(n,i){fetch(r+t+"/documents/"+s,{method:"DELETE",headers:o(t,e)}).then((function(t){202==t.status?n({status:t.status,text:t.statusText}):i({status:t.status,text:t.statusText})})).catch((function(t){i({status:400,text:t})}))}))},deleteDocumentsBatch:function(t,e,s){return new i((function(n,i){fetch(r+t+"/documents:batch",{method:"DELETE",headers:o(t,e),body:JSON.stringify(s)}).then((function(t){202==t.status?n({status:t.status,text:t.statusText}):i({status:t.status,text:t.statusText})})).catch((function(t){i({status:400,text:t})}))}))}}},function(t,e,s){"use strict";s(0).polyfill(),s(1);t.exports=function(t,e){"undefined"!=typeof window&&window.navigator&&window.navigator.sendBeacon?navigator.sendBeacon("https://api.addsearch.com/v1/stats/"+t+"/",JSON.stringify(e)):fetch("https://api.addsearch.com/v1/stats/"+t+"/",{method:"POST",headers:{"Content-Type":"text/plain"},body:JSON.stringify(e)})}},function(t,e,s){"use strict";t.exports=function(){this.settings={keyword:"*",callback:null,fuzzy:"auto",paging:{page:1,pageSize:10,sortBy:"relevance",sortOrder:"desc"},customFieldFilters:[],userToken:null,suggestionsSize:10,facetFields:[],autocomplete:{size:10}},this.getSettings=function(){return this.settings},this.setKeyword=function(t){this.settings.keyword=t||"*"},this.setCallback=function(t){this.settings.callback=t},this.setSuggestionsPrefix=function(t){this.settings.suggestionsPrefix=t},this.setSuggestionsSize=function(t){this.settings.suggestionsSize=t},this.setAutocompleteSize=function(t){this.settings.autocomplete.size=t},this.setAutocompleteParams=function(t,e){this.settings.autocomplete.field=t,this.settings.autocomplete.prefix=e},this.setLanguage=function(t){if(t&&2!==t.length)throw'use 2-char language code (e.g. "en")';this.settings.lang=t},this.setFuzzyMatch=function(t){if(!0!==t&&!1!==t&&"auto"!==t&&"retry"!==t)throw"fuzzy matching can be true, false, 'auto', or 'retry'";this.settings.fuzzy=t},this.setPostfixWildcard=function(t){this.settings.postfixWildcard=t},this.setCollectAnalytics=function(t){this.settings.collectAnalytics=t},this.setCategoryFilters=function(t){this.settings.categories=t},this.setFilterObject=function(t){this.settings.filterObject=t},this.setPriceRangeFilter=function(t,e){this.settings.priceFromCents=t,this.settings.priceToCents=e},this.addCustomFieldFilter=function(t,e){var s=encodeURIComponent(t+"="+e);-1===this.settings.customFieldFilters.indexOf(s)&&this.settings.customFieldFilters.push(s)},this.removeCustomFieldFilter=function(t,e){var s=!1,n=encodeURIComponent(t+"="+e);e||(s=!0,n=encodeURIComponent(t+"="));for(var i=this.settings.customFieldFilters.length;i>0;i--){var r=this.settings.customFieldFilters[i-1];(s&&0===r.indexOf(n)||r===n)&&this.settings.customFieldFilters.splice(i-1,1)}},this.setDateFilter=function(t,e){this.settings.dateFrom=t,this.settings.dateTo=e},this.setKeyword=function(t){this.settings.keyword=t||"*"},this.setJWT=function(t){this.settings.jwt=t},this.setUserToken=function(t){this.settings.userToken=t},this.setPersonalizationEvents=function(t){this.settings.personalizationEvents=t},this.setResultType=function(t){this.settings.resultType=t},this.addFacetField=function(t){-1===this.settings.facetFields.indexOf(t)&&this.settings.facetFields.push(t)},this.addRangeFacet=function(t,e){this.settings.rangeFacets||(this.settings.rangeFacets=[]),this.settings.rangeFacets.push({field:t,ranges:e})},this.addStatsField=function(t){this.settings.statsFields||(this.settings.statsFields=[]),-1===this.settings.statsFields.indexOf(t)&&this.settings.statsFields.push(t)},this.setNumberOfFacets=function(t){this.settings.numFacets=t},this.setPaging=function(t,e,s,n){if(t<1)throw"page must be 1 or bigger";if(e<1||e>300)throw"pageSize must be 1-300";if("asc"!==n&&"desc"!==n)throw"sortOrder must be asc or desc";this.settings.paging.page=t,this.settings.paging.pageSize=e,this.settings.paging.sortBy=s,this.settings.paging.sortOrder=n},this.setShuffleAndLimitTo=function(t){this.settings.shuffleAndLimitTo=t},this.nextPage=function(){this.settings.paging.page=this.settings.paging.page+1},this.previousPage=function(){this.settings.paging.page>0&&(this.settings.paging.page=this.settings.paging.page-1)}}},function(t,e){t.exports=function(t,e){var s,n=0;function i(){s&&clearTimeout(s)}return function(){var r=this,o=Date.now()-n,a=arguments;function u(){n=Date.now(),e.apply(r,a)}i(),o>t?u():s=setTimeout(u,t-o)}}}]);
{
"name": "addsearch-js-client",
"version": "0.4.3",
"version": "0.5.0",
"description": "AddSearch API JavaScript client",

@@ -40,18 +40,19 @@ "main": "index.js",

"es6-promise": "^4.2.8",
"isomorphic-fetch": "^2.2.1"
"isomorphic-fetch": "^2.2.1",
"js-base64": "^3.4.5"
},
"devDependencies": {
"@babel/cli": "^7.8.4",
"@babel/core": "^7.8.6",
"@babel/preset-env": "^7.8.6",
"@babel/register": "^7.8.6",
"babel-loader": "^8.0.6",
"@babel/cli": "^7.10.5",
"@babel/core": "^7.11.1",
"@babel/preset-env": "^7.11.0",
"@babel/register": "^7.10.5",
"babel-loader": "^8.1.0",
"esm": "^3.2.25",
"fetch-mock": "^9.0.0",
"mocha": "^7.1.0",
"fetch-mock": "^9.10.6",
"mocha": "^8.1.1",
"node-fetch": "^2.6.0",
"uglify-js": "^3.8.0",
"webpack": "^4.42.0",
"webpack-cli": "^3.3.11"
"uglify-js": "^3.10.1",
"webpack": "^4.44.1",
"webpack-cli": "^3.3.12"
}
}

@@ -10,3 +10,3 @@ # AddSearch Search API Client for JavaScript

```html
<script src="https://cdn.jsdelivr.net/npm/addsearch-js-client@0.4/dist/addsearch-js-client.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/addsearch-js-client@0.5/dist/addsearch-js-client.min.js"></script>
```

@@ -44,5 +44,6 @@ Or install the library locally to use it with Node.js:

## Publicly accessible functions
## Search API
The client provides the following functions.
The client provides following functions to execute search queries. To use the client library for indexing,
see [Indexing API](https://github.com/AddSearch/js-client-library#indexing-api).

@@ -306,7 +307,183 @@ #### Fetch search results

```js
// Set API call throttle time in milliseconds. Default is 200.
// Set Search API throttle time in milliseconds. Default is 200.
client.setThrottleTime(500);
```
## Supported web browsers and node.js versions
## Indexing API
With the Indexing API, you can fetch, create, update, and delete single documents or
batches of documents.
Indexing API functions are meant to be used with Node.js. Never expose secret key in your
website code.
```js
// Create client with your keys
var client = new AddSearchClient('YOUR PUBLIC SITEKEY', 'YOUR SECRET KEY');
```
The secret key can be found from AddSearch Dashboard's "Setup" > "Keys and installation" page.
Always keep the key secret.
All Indexing API functions are Promise-based.
### Document structure
Documents can contain a set of pre-defined fields, as well as any number of custom fields
defined under the **custom_fields** key.
Using pre-defined fields is optional, but default [Search UI](https://github.com/AddSearch/search-ui) components
display them by default, so pre-defined field give you visible results a bit faster.
Pre-defined fields are: url, title, and main_content.
Example document:
```js
const doc = {
id: '1234',
url: 'https://www.example-store.com/product-x',
title: 'Example product',
main_content: 'Lorem ipsum',
custom_fields: {
'name': 'Example product',
'description': 'Description for the example product',
'price_cents': 599,
'average_customer_rating': 4.5,
'release_date': 1589200255
}
}
```
Data types for custom fields are automatically detected from the content. Supported data types are:
- text
- integer
- double
Dates should be defined as UNIX timestamps with integer values.
### Document ID
If the **id** is not defined in the document at indexing time, it is generated automatically either randomly
or from the **url** field.
```js
// ID defined by the user
const docWithDefinedId = {
id: '1234',
custom_fields: {}
}
```
```js
// ID created from the URL field (md5 of the url)
const docWithURL= {
url: 'https://..',
custom_fields: {}
}
```
```js
// ID generated randomly
const docWithAutogeneratedId = {
// No id or url fields
custom_fields: {}
}
```
### Save document
Add a document to the index, or update a document.
```js
const doc = {
id: '1234',
custom_fields: {
'name': 'Example product'
}
};
// Save document
client.saveDocument(doc)
.then(response => {
console.log(response);
})
.catch(error => {
console.log(error);
});
```
### Get document by ID
Fetch a specific document by ID.
```js
client.getDocument(id)
.then(response => {
console.log(response);
})
.catch(error => {
console.log(error);
});
```
### Delete document by ID
Delete a specific document by ID.
```js
client.deleteDocument(id)
.then(response => {
console.log(response);
})
.catch(error => {
console.log(error);
});
```
### Save batch of documents
Add or update bunch of documents defined in an array.
```js
const batch = {
documents: [
{
id: '1234',
custom_fields: {
'name': 'Product 1'
}
},
{
id: '5678',
custom_fields: {
'name': 'Product 2'
}
}
]
};
// Save batch of documents
client.saveDocumentsBatch(batch)
.then(response => {
console.log(response);
})
.catch(error => {
console.log(error);
});
```
### Delete batch of documents
Delete multiple documents with an array of document IDs.
```js
// Array of document IDs
const batch = {
documents: ["1234", "5678"]
};
// Delete batch of documents
client.deleteDocumentsBatch(batch)
.then(response => {
console.log(response);
})
.catch(error => {
console.log(error);
});
```
## Supported browsers
The client is tested on

@@ -318,3 +495,3 @@ - Chrome

- Internet Explorer 10+
- Node.js 4+
- Node.js

@@ -321,0 +498,0 @@

'use strict';
var executeApiFetch = require('./apifetch');
var indexingapi = require('./indexingapi');
var sendStats = require('./stats');

@@ -11,4 +12,5 @@ var Settings = require('./settings');

var client = function(sitekey) {
var client = function(sitekey, privatekey) {
this.sitekey = sitekey;
this.privatekey = privatekey;
this.settings = new Settings();

@@ -96,2 +98,34 @@ this.sessionId = ('a-' + (Math.random() * 100000000)).substring(0, 10);

/**
* Indexing API functions
*/
this.getDocument = function(id) {
return indexingapi.getDocument(this.sitekey, this.privatekey, id);
}
this.saveDocument = function(document) {
return indexingapi.saveDocument(this.sitekey, this.privatekey, document);
}
this.saveDocumentsBatch = function(batch) {
if (!batch || !batch.documents || !Array.isArray(batch.documents)) {
throw "Please provide an array of documents: {documents: []}";
}
return indexingapi.saveDocumentsBatch(this.sitekey, this.privatekey, batch);
}
this.deleteDocument = function(id) {
return indexingapi.deleteDocument(this.sitekey, this.privatekey, id);
}
this.deleteDocumentsBatch = function(batch) {
if (!batch || !batch.documents || !Array.isArray(batch.documents)) {
throw "Please provide an array of document ids: {documents: []}";
}
return indexingapi.deleteDocumentsBatch(this.sitekey, this.privatekey, batch);
}
/**
* Public functions

@@ -98,0 +132,0 @@ */

@@ -1,7 +0,18 @@

var isFunction = function(fn) {
const isFunction = function(fn) {
return fn && {}.toString.call(fn) === '[object Function]';
}
const base64 = function(s) {
global.window = {};
if (window && window.btoa) {
return window.btoa(s);
}
else if (Buffer) {
return Buffer.from(s).toString('base64');
}
}
module.exports = {
isFunction: isFunction
isFunction,
base64
}

@@ -7,3 +7,2 @@ var assert = require('assert');

describe('isFunction', function() {
it('function should be properly detected', function() {

@@ -18,2 +17,9 @@ var f = function(f) { console.log(f); };

});
describe('base64', function() {
it('string should be encoded properly', function() {
assert.equal(util.base64('test'), 'dGVzdA==');
});
});
});

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

var webpack = require('webpack');
var PACKAGE = require('./package.json');
var banner = PACKAGE.name + ' ' + PACKAGE.version;
const webpack = require('webpack');
const PACKAGE = require('./package.json');
const banner = PACKAGE.name + ' ' + PACKAGE.version;

@@ -17,2 +17,5 @@ module.exports = {

],
node: {
Buffer: false
},
mode: 'production',

@@ -19,0 +22,0 @@ module: {

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