New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

autotune

Package Overview
Dependencies
Maintainers
1
Versions
124
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

autotune - npm Package Compare versions

Comparing version 0.0.13 to 0.0.14

33

dist/index.browser.js

@@ -78,3 +78,3 @@ (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.autotune = 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){

state.startExperimentsTimer = setTimeout(function () { return __awaiter(_this, void 0, void 0, function () {
var experiments, response;
var experiments, response, e_1;
return __generator(this, function (_a) {

@@ -90,2 +90,5 @@ switch (_a.label) {

state.startExperimentsTimer = undefined;
_a.label = 1;
case 1:
_a.trys.push([1, 3, , 4]);
return [4, http("POST", api("/startExperiments"), {

@@ -95,4 +98,10 @@ appKey: state.appKey,

})];
case 1:
case 2:
response = _a.sent();
return [3, 4];
case 3:
e_1 = _a.sent();
log("Failed to start experiments", e_1);
return [2];
case 4:
log("/startExperiments response", response);

@@ -120,3 +129,3 @@ if (response !== undefined) {

state.completeExperimentsTimer = setTimeout(function () { return __awaiter(_this, void 0, void 0, function () {
var experiments, experimentsByKey;
var experiments, experimentsByKey, e_2;
return __generator(this, function (_a) {

@@ -131,2 +140,5 @@ switch (_a.label) {

log("Completing experiments", experimentsByKey);
_a.label = 1;
case 1:
_a.trys.push([1, 3, , 4]);
return [4, http("POST", api("/completeExperiments"), {

@@ -136,5 +148,10 @@ appKey: state.appKey,

})];
case 1:
case 2:
_a.sent();
return [2];
return [3, 4];
case 3:
e_2 = _a.sent();
log("Failed to complete experiments", e_2);
return [3, 4];
case 4: return [2];
}

@@ -173,3 +190,3 @@ });

return __awaiter(this, void 0, void 0, function () {
var outcomes, e_1, experiments;
var outcomes, e_3, experiments;
return __generator(this, function (_a) {

@@ -188,4 +205,4 @@ switch (_a.label) {

case 3:
e_1 = _a.sent();
log("ERROR getting outcomes", e_1);
e_3 = _a.sent();
log("ERROR getting outcomes", e_3);
return [3, 4];

@@ -192,0 +209,0 @@ case 4:

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

!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).autotune=e()}}(function(){return function o(u,s,a){function p(t,e){if(!s[t]){if(!u[t]){var n="function"==typeof require&&require;if(!e&&n)return n(t,!0);if(c)return c(t,!0);var r=new Error("Cannot find module '"+t+"'");throw r.code="MODULE_NOT_FOUND",r}var i=s[t]={exports:{}};u[t][0].call(i.exports,function(e){return p(u[t][1][e]||e)},i,i.exports,o,u,s,a)}return s[t].exports}for(var c="function"==typeof require&&require,e=0;e<a.length;e++)p(a[e]);return p}({1:[function(e,t,n){"use strict";var r=this&&this.__awaiter||function(o,u,s,a){return new(s||(s=Promise))(function(e,t){function n(e){try{i(a.next(e))}catch(e){t(e)}}function r(e){try{i(a.throw(e))}catch(e){t(e)}}function i(t){t.done?e(t.value):new s(function(e){e(t.value)}).then(n,r)}i((a=a.apply(o,u||[])).next())})},u=this&&this.__generator||function(n,r){var i,o,u,e,s={label:0,sent:function(){if(1&u[0])throw u[1];return u[1]},trys:[],ops:[]};return e={next:t(0),throw:t(1),return:t(2)},"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(t){return function(e){return function(t){if(i)throw new TypeError("Generator is already executing.");for(;s;)try{if(i=1,o&&(u=o[2&t[0]?"return":t[0]?"throw":"next"])&&!(u=u.call(o,t[1])).done)return u;switch(o=0,u&&(t=[0,u.value]),t[0]){case 0:case 1:u=t;break;case 4:return s.label++,{value:t[1],done:!1};case 5:s.label++,o=t[1],t=[0];continue;case 7:t=s.ops.pop(),s.trys.pop();continue;default:if(!(u=0<(u=s.trys).length&&u[u.length-1])&&(6===t[0]||2===t[0])){s=0;continue}if(3===t[0]&&(!u||t[1]>u[0]&&t[1]<u[3])){s.label=t[1];break}if(6===t[0]&&s.label<u[1]){s.label=u[1],u=t;break}if(u&&s.label<u[2]){s.label=u[2],s.ops.push(t);break}u[2]&&s.ops.pop(),s.trys.pop();continue}t=r.call(n,s)}catch(e){t=[6,e],o=0}finally{i=u=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}([t,e])}}};Object.defineProperty(n,"__esModule",{value:!0});var i=!0;function s(e){return"https://2vyiuehl9j.execute-api.us-east-2.amazonaws.com/prod/"+e}var a={appKey:"",experiments:{},defaultCompletions:{},queuedCompletedExperiments:{},queuedStartedExperiments:{}};function p(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];i&&console.log.apply(console,["AUTOTUNE"].concat(e))}function o(e){var t=this;void 0!==a.startExperimentsTimer&&(clearTimeout(a.startExperimentsTimer),a.startExperimentsTimer=void 0),a.queuedStartedExperiments[e.name]=e,a.startExperimentsTimer=setTimeout(function(){return r(t,void 0,void 0,function(){var i,o;return u(this,function(e){switch(e.label){case 0:return t=a.queuedStartedExperiments,n=function(e){return{options:e.options,pick:e.pick}},r={},Object.getOwnPropertyNames(t).forEach(function(e){return r[e]=n(t[e],e)}),p("Starting experiments",i=r),a.queuedStartedExperiments={},a.startExperimentsTimer=void 0,[4,f("POST",s("/startExperiments"),{appKey:a.appKey,experiments:i})];case 1:return p("/startExperiments response",o=e.sent()),void 0!==o&&Object.getOwnPropertyNames(o.experiments).forEach(function(e){var t=a.experiments[e];void 0!==t&&(t.key=o.experiments[e].key)}),[2]}var t,n,r})})},100)}function c(e){var t=this;void 0!==a.completeExperimentsTimer&&(clearTimeout(a.completeExperimentsTimer),a.completeExperimentsTimer=void 0),a.queuedCompletedExperiments[e.name]=e,a.completeExperimentsTimer=setTimeout(function(){return r(t,void 0,void 0,function(){var n,r;return u(this,function(e){switch(e.label){case 0:return t=a.queuedCompletedExperiments,n=Object.getOwnPropertyNames(t).map(function(e){return t[e]}),a.queuedCompletedExperiments={},a.completeExperimentsTimer=void 0,r={},n.forEach(function(e){return r[e.key]={pick:e.pick,payoff:e.payoff}}),p("Completing experiments",r),[4,f("POST",s("/completeExperiments"),{appKey:a.appKey,experiments:r})];case 1:return e.sent(),[2]}var t})})},10)}function f(r,i,o){return void 0===o&&(o=void 0),new Promise(function(e,t){if("undefined"==typeof XMLHttpRequest)return t("Not running in browser");var n=new XMLHttpRequest;n.open(r,i,!0),n.setRequestHeader("Content-Type","application/json"),n.onerror=function(){return t(n.statusText)},n.onreadystatechange=function(){4==n.readyState&&(200==n.status?e(JSON.parse(n.responseText)):t("Request failed with status "+n.status))},void 0!==o?n.send(JSON.stringify(o)):n.send()})}function l(e){var t=a.experiments[e];return void 0===t&&(t=a.experiments[e]=new m(e)),t}n.initialize=function(n){return r(this,void 0,void 0,function(){var i,o;return u(this,function(e){switch(e.label){case 0:p("Initialize",n),i={},e.label=1;case 1:return e.trys.push([1,3,,4]),[4,f("GET",(t=n,"https://s3.us-east-2.amazonaws.com/autotune-outcomes/"+t+".json"))];case 2:return i=e.sent(),[3,4];case 3:return p("ERROR getting outcomes",e.sent()),[3,4];case 4:return p("Got outcomes",i),o={},Object.getOwnPropertyNames(i).forEach(function(e){var t=i[e],n=t.bestOption,r=t.epsilon;o[e]=new m(e,n,r)}),a={appKey:n,experiments:o,defaultCompletions:{},queuedCompletedExperiments:{},queuedStartedExperiments:{}},[2,{}]}var t})})},n.experiment=l;var m=function(){function e(e,t,n){void 0===t&&(t=void 0),void 0===n&&(n=1),this.name=e,this.bestOption=t,this.epsilon=n}return e.prototype.setValueAndStartExperiment=function(e){return void 0===this.pick&&(this.pick=e,o(this)),this.pick},e.prototype.complete=function(t){return void 0===t&&(t=1),r(this,void 0,void 0,function(){return u(this,function(e){return this.payoff=t,c(this),[2]})})},e.prototype.flipCoin=function(){return"true"===this.oneOf("true","false")},e.prototype.oneOf=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return this.options=t,e=void 0===this.bestOption||Math.random()<this.epsilon?t[Math.floor(Math.random()*t.length)]:this.bestOption,this.setValueAndStartExperiment(e)},e}();n.Experiment=m,n.flipCoin=function(e){var t=l(e);return(a.defaultCompletions[e]=t).flipCoin()},n.oneOf=function(e,t){var n=l(e);return(a.defaultCompletions[e]=n).oneOf.apply(n,t)},n.complete=function(t){void 0===t&&(t=1);var n=a.defaultCompletions;Object.getOwnPropertyNames(n).forEach(function(e){return n[e].complete(t)})}},{}]},{},[1])(1)});
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).autotune=e()}}(function(){return function o(s,u,a){function p(t,e){if(!u[t]){if(!s[t]){var n="function"==typeof require&&require;if(!e&&n)return n(t,!0);if(c)return c(t,!0);var r=new Error("Cannot find module '"+t+"'");throw r.code="MODULE_NOT_FOUND",r}var i=u[t]={exports:{}};s[t][0].call(i.exports,function(e){return p(s[t][1][e]||e)},i,i.exports,o,s,u,a)}return u[t].exports}for(var c="function"==typeof require&&require,e=0;e<a.length;e++)p(a[e]);return p}({1:[function(e,t,n){"use strict";var r=this&&this.__awaiter||function(o,s,u,a){return new(u||(u=Promise))(function(e,t){function n(e){try{i(a.next(e))}catch(e){t(e)}}function r(e){try{i(a.throw(e))}catch(e){t(e)}}function i(t){t.done?e(t.value):new u(function(e){e(t.value)}).then(n,r)}i((a=a.apply(o,s||[])).next())})},s=this&&this.__generator||function(n,r){var i,o,s,e,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return e={next:t(0),throw:t(1),return:t(2)},"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(t){return function(e){return function(t){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=o[2&t[0]?"return":t[0]?"throw":"next"])&&!(s=s.call(o,t[1])).done)return s;switch(o=0,s&&(t=[0,s.value]),t[0]){case 0:case 1:s=t;break;case 4:return u.label++,{value:t[1],done:!1};case 5:u.label++,o=t[1],t=[0];continue;case 7:t=u.ops.pop(),u.trys.pop();continue;default:if(!(s=0<(s=u.trys).length&&s[s.length-1])&&(6===t[0]||2===t[0])){u=0;continue}if(3===t[0]&&(!s||t[1]>s[0]&&t[1]<s[3])){u.label=t[1];break}if(6===t[0]&&u.label<s[1]){u.label=s[1],s=t;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(t);break}s[2]&&u.ops.pop(),u.trys.pop();continue}t=r.call(n,u)}catch(e){t=[6,e],o=0}finally{i=s=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}([t,e])}}};Object.defineProperty(n,"__esModule",{value:!0});var i=!0;function u(e){return"https://2vyiuehl9j.execute-api.us-east-2.amazonaws.com/prod/"+e}var a={appKey:"",experiments:{},defaultCompletions:{},queuedCompletedExperiments:{},queuedStartedExperiments:{}};function p(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];i&&console.log.apply(console,["AUTOTUNE"].concat(e))}function o(e){var t=this;void 0!==a.startExperimentsTimer&&(clearTimeout(a.startExperimentsTimer),a.startExperimentsTimer=void 0),a.queuedStartedExperiments[e.name]=e,a.startExperimentsTimer=setTimeout(function(){return r(t,void 0,void 0,function(){var i,o;return s(this,function(e){switch(e.label){case 0:t=a.queuedStartedExperiments,n=function(e){return{options:e.options,pick:e.pick}},r={},Object.getOwnPropertyNames(t).forEach(function(e){return r[e]=n(t[e],e)}),p("Starting experiments",i=r),a.queuedStartedExperiments={},a.startExperimentsTimer=void 0,e.label=1;case 1:return e.trys.push([1,3,,4]),[4,f("POST",u("/startExperiments"),{appKey:a.appKey,experiments:i})];case 2:return o=e.sent(),[3,4];case 3:return p("Failed to start experiments",e.sent()),[2];case 4:return p("/startExperiments response",o),void 0!==o&&Object.getOwnPropertyNames(o.experiments).forEach(function(e){var t=a.experiments[e];void 0!==t&&(t.key=o.experiments[e].key)}),[2]}var t,n,r})})},100)}function c(e){var t=this;void 0!==a.completeExperimentsTimer&&(clearTimeout(a.completeExperimentsTimer),a.completeExperimentsTimer=void 0),a.queuedCompletedExperiments[e.name]=e,a.completeExperimentsTimer=setTimeout(function(){return r(t,void 0,void 0,function(){var n,r;return s(this,function(e){switch(e.label){case 0:t=a.queuedCompletedExperiments,n=Object.getOwnPropertyNames(t).map(function(e){return t[e]}),a.queuedCompletedExperiments={},a.completeExperimentsTimer=void 0,r={},n.forEach(function(e){return r[e.key]={pick:e.pick,payoff:e.payoff}}),p("Completing experiments",r),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,f("POST",u("/completeExperiments"),{appKey:a.appKey,experiments:r})];case 2:return e.sent(),[3,4];case 3:return p("Failed to complete experiments",e.sent()),[3,4];case 4:return[2]}var t})})},10)}function f(r,i,o){return void 0===o&&(o=void 0),new Promise(function(e,t){if("undefined"==typeof XMLHttpRequest)return t("Not running in browser");var n=new XMLHttpRequest;n.open(r,i,!0),n.setRequestHeader("Content-Type","application/json"),n.onerror=function(){return t(n.statusText)},n.onreadystatechange=function(){4==n.readyState&&(200==n.status?e(JSON.parse(n.responseText)):t("Request failed with status "+n.status))},void 0!==o?n.send(JSON.stringify(o)):n.send()})}function l(e){var t=a.experiments[e];return void 0===t&&(t=a.experiments[e]=new m(e)),t}n.initialize=function(n){return r(this,void 0,void 0,function(){var i,o;return s(this,function(e){switch(e.label){case 0:p("Initialize",n),i={},e.label=1;case 1:return e.trys.push([1,3,,4]),[4,f("GET",(t=n,"https://s3.us-east-2.amazonaws.com/autotune-outcomes/"+t+".json"))];case 2:return i=e.sent(),[3,4];case 3:return p("ERROR getting outcomes",e.sent()),[3,4];case 4:return p("Got outcomes",i),o={},Object.getOwnPropertyNames(i).forEach(function(e){var t=i[e],n=t.bestOption,r=t.epsilon;o[e]=new m(e,n,r)}),a={appKey:n,experiments:o,defaultCompletions:{},queuedCompletedExperiments:{},queuedStartedExperiments:{}},[2,{}]}var t})})},n.experiment=l;var m=function(){function e(e,t,n){void 0===t&&(t=void 0),void 0===n&&(n=1),this.name=e,this.bestOption=t,this.epsilon=n}return e.prototype.setValueAndStartExperiment=function(e){return void 0===this.pick&&(this.pick=e,o(this)),this.pick},e.prototype.complete=function(t){return void 0===t&&(t=1),r(this,void 0,void 0,function(){return s(this,function(e){return this.payoff=t,c(this),[2]})})},e.prototype.flipCoin=function(){return"true"===this.oneOf("true","false")},e.prototype.oneOf=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return this.options=t,e=void 0===this.bestOption||Math.random()<this.epsilon?t[Math.floor(Math.random()*t.length)]:this.bestOption,this.setValueAndStartExperiment(e)},e}();n.Experiment=m,n.flipCoin=function(e){var t=l(e);return(a.defaultCompletions[e]=t).flipCoin()},n.oneOf=function(e,t){var n=l(e);return(a.defaultCompletions[e]=n).oneOf.apply(n,t)},n.complete=function(t){void 0===t&&(t=1);var n=a.defaultCompletions;Object.getOwnPropertyNames(n).forEach(function(e){return n[e].complete(t)})}},{}]},{},[1])(1)});

@@ -77,3 +77,3 @@ "use strict";

state.startExperimentsTimer = setTimeout(function () { return __awaiter(_this, void 0, void 0, function () {
var experiments, response;
var experiments, response, e_1;
return __generator(this, function (_a) {

@@ -89,2 +89,5 @@ switch (_a.label) {

state.startExperimentsTimer = undefined;
_a.label = 1;
case 1:
_a.trys.push([1, 3, , 4]);
return [4, http("POST", api("/startExperiments"), {

@@ -94,4 +97,10 @@ appKey: state.appKey,

})];
case 1:
case 2:
response = _a.sent();
return [3, 4];
case 3:
e_1 = _a.sent();
log("Failed to start experiments", e_1);
return [2];
case 4:
log("/startExperiments response", response);

@@ -119,3 +128,3 @@ if (response !== undefined) {

state.completeExperimentsTimer = setTimeout(function () { return __awaiter(_this, void 0, void 0, function () {
var experiments, experimentsByKey;
var experiments, experimentsByKey, e_2;
return __generator(this, function (_a) {

@@ -130,2 +139,5 @@ switch (_a.label) {

log("Completing experiments", experimentsByKey);
_a.label = 1;
case 1:
_a.trys.push([1, 3, , 4]);
return [4, http("POST", api("/completeExperiments"), {

@@ -135,5 +147,10 @@ appKey: state.appKey,

})];
case 1:
case 2:
_a.sent();
return [2];
return [3, 4];
case 3:
e_2 = _a.sent();
log("Failed to complete experiments", e_2);
return [3, 4];
case 4: return [2];
}

@@ -172,3 +189,3 @@ });

return __awaiter(this, void 0, void 0, function () {
var outcomes, e_1, experiments;
var outcomes, e_3, experiments;
return __generator(this, function (_a) {

@@ -187,4 +204,4 @@ switch (_a.label) {

case 3:
e_1 = _a.sent();
log("ERROR getting outcomes", e_1);
e_3 = _a.sent();
log("ERROR getting outcomes", e_3);
return [3, 4];

@@ -191,0 +208,0 @@ case 4:

{
"name": "autotune",
"version": "0.0.13",
"version": "0.0.14",
"description": "Automatically tune JavaScript apps",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

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