Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

deoptimize

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

deoptimize - npm Package Compare versions

Comparing version
0.1.0
to
0.1.1
+4
dist/by.d.ts
export declare function byDate(date: Date): Promise<void>;
export declare function byDateSync(date: Date): void;
export declare function by(factor: number): Promise<void>;
export declare function bySync(factor: number): void;
export declare const configuration: {
minSleep: number;
maxSleep: number;
intervalSize: number;
referenceDate: Date;
intervals: () => number;
findInterval: (date: Date) => number;
};
export declare function test(): void;
export declare function computeSleepTimeFromDate(date: Date): number;
export declare function findInterval(date: Date): number;
import {sleep, sleepSync} from './sleep';
import {computeSleepTimeFromDate} from './util';
import {configuration} from "./configuration";
import * as http from "http";
export function byDate(date: Date): Promise<void> {
const sleepTime = computeSleepTimeFromDate(date);
return sleep(sleepTime);
}
export function byDateSync(date: Date): void {
const sleepTime = computeSleepTimeFromDate(date);
sleepSync(sleepTime);
}
export function by(factor: number): Promise<void> {
const sleepTime = factor * configuration.intervalSize;
return sleep(sleepTime);
}
export function bySync(factor: number): void {
const sleepTime = factor * configuration.intervalSize;
sleepSync(sleepTime);
}
import {findInterval} from './util';
export const configuration = {
minSleep: 0, //minimum sleep in ms
maxSleep: 10000, // maximum sleep in ms
intervalSize: 50, //50ms
referenceDate: new Date(),
intervals: () => configuration.maxSleep / configuration.intervalSize,
findInterval: (date: Date): number => {
const duration = date.getTime() - configuration.referenceDate.getTime();
const period = duration/ configuration.intervals();
const interval = (date.getTime()-Date.now())/period;
return Math.floor(interval);
}
}
import {byDateSync} from "./by";
export function test() {
console.log("Ceva");
const start = new Date(Date.now() + 1000);
byDateSync(start);
const end = Date.now();
console.log(end - start.getTime())
}
import { configuration } from './configuration';
export function computeSleepTimeFromDate(date: Date): number{
if(!(date instanceof Date)){
throw TypeError(`Parameter is not of type Date. Found ${typeof date}`);
}
const interval = configuration.findInterval(date);
const time = configuration.maxSleep-interval*configuration.intervalSize;
console.log(time)
return time;
}
export function findInterval(date: Date): number {
const duration = date.getTime() - configuration.referenceDate.getTime();
const period = duration/ configuration.intervals();
const interval = (date.getTime()-Date.now())/period;
return Math.floor(interval);
}
+68
-0
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
function sleep(ms) {
return new Promise(function (resolve) {
return setTimeout(resolve, ms);
});
}
function sleepSync(ms) {
var stop = new Date().getTime();
while (new Date().getTime() < stop + ms) {
}
}
var configuration = {
minSleep: 0,
maxSleep: 10000,
intervalSize: 50,
referenceDate: /*#__PURE__*/new Date(),
intervals: function intervals() {
return configuration.maxSleep / configuration.intervalSize;
},
findInterval: function findInterval(date) {
var duration = date.getTime() - configuration.referenceDate.getTime();
var period = duration / configuration.intervals();
var interval = (date.getTime() - Date.now()) / period;
return Math.floor(interval);
}
};
function computeSleepTimeFromDate(date) {
if (!(date instanceof Date)) {
throw TypeError("Parameter is not of type Date. Found " + typeof date);
}
var interval = configuration.findInterval(date);
var time = configuration.maxSleep - interval * configuration.intervalSize;
console.log(time);
return time;
}
function byDate(date) {
var sleepTime = computeSleepTimeFromDate(date);
return sleep(sleepTime);
}
function byDateSync(date) {
var sleepTime = computeSleepTimeFromDate(date);
sleepSync(sleepTime);
}
function by(factor) {
var sleepTime = factor * configuration.intervalSize;
return sleep(sleepTime);
}
function bySync(factor) {
var sleepTime = factor * configuration.intervalSize;
sleepSync(sleepTime);
}
var deoptimize = function deoptimize() {
return {
byDate: byDate,
byDateSync: byDateSync,
by: by,
bySync: bySync
};
};
exports.deoptimize = deoptimize;
//# sourceMappingURL=deoptimize.cjs.development.js.map
+1
-1

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

{"version":3,"file":"deoptimize.cjs.development.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
{"version":3,"file":"deoptimize.cjs.development.js","sources":["../src/sleep.ts","../src/configuration.ts","../src/util.ts","../src/by.ts","../src/index.ts"],"sourcesContent":["export function sleep(ms:number): Promise<void> {\r\n return new Promise(resolve => setTimeout(resolve, ms));\r\n}\r\n\r\nexport function sleepSync(ms:number){\r\n var stop = new Date().getTime();\r\n while(new Date().getTime() < stop + ms) {\r\n ;\r\n }\r\n}","import {findInterval} from './util';\r\n\r\nexport const configuration = {\r\n minSleep: 0, //minimum sleep in ms\r\n maxSleep: 10000, // maximum sleep in ms\r\n intervalSize: 50, //50ms\r\n referenceDate: new Date(),\r\n intervals: () => configuration.maxSleep / configuration.intervalSize,\r\n findInterval: (date: Date): number => {\r\n const duration = date.getTime() - configuration.referenceDate.getTime();\r\n const period = duration/ configuration.intervals();\r\n const interval = (date.getTime()-Date.now())/period;\r\n return Math.floor(interval);\r\n }\r\n}\r\n","import { configuration } from './configuration';\r\n\r\nexport function computeSleepTimeFromDate(date: Date): number{\r\n if(!(date instanceof Date)){\r\n throw TypeError(`Parameter is not of type Date. Found ${typeof date}`);\r\n }\r\n\r\n const interval = configuration.findInterval(date);\r\n const time = configuration.maxSleep-interval*configuration.intervalSize;\r\n console.log(time)\r\n return time;\r\n}\r\n\r\nexport function findInterval(date: Date): number {\r\n const duration = date.getTime() - configuration.referenceDate.getTime();\r\n const period = duration/ configuration.intervals();\r\n const interval = (date.getTime()-Date.now())/period;\r\n return Math.floor(interval);\r\n}","import {sleep, sleepSync} from './sleep';\r\nimport {computeSleepTimeFromDate} from './util';\r\nimport {configuration} from \"./configuration\";\r\nimport * as http from \"http\";\r\n\r\nexport function byDate(date: Date): Promise<void> {\r\n const sleepTime = computeSleepTimeFromDate(date);\r\n return sleep(sleepTime);\r\n}\r\n\r\nexport function byDateSync(date: Date): void {\r\n const sleepTime = computeSleepTimeFromDate(date);\r\n sleepSync(sleepTime);\r\n}\r\n\r\nexport function by(factor: number): Promise<void> {\r\n const sleepTime = factor * configuration.intervalSize;\r\n return sleep(sleepTime);\r\n}\r\n\r\nexport function bySync(factor: number): void {\r\n const sleepTime = factor * configuration.intervalSize;\r\n sleepSync(sleepTime);\r\n}\r\n\r\n","import {by, byDate, byDateSync, bySync} from './by';\r\n\r\n\r\nexport const deoptimize = function deoptimize() {\r\n return {\r\n byDate,\r\n byDateSync,\r\n by,\r\n bySync\r\n }\r\n};\r\n"],"names":["sleep","ms","Promise","resolve","setTimeout","sleepSync","stop","Date","getTime","configuration","minSleep","maxSleep","intervalSize","referenceDate","intervals","findInterval","date","duration","period","interval","now","Math","floor","computeSleepTimeFromDate","TypeError","time","console","log","byDate","sleepTime","byDateSync","by","factor","bySync","deoptimize"],"mappings":";;;;SAAgBA,MAAMC;AAClB,SAAO,IAAIC,OAAJ,CAAY,UAAAC,OAAO;AAAA,WAAIC,UAAU,CAACD,OAAD,EAAUF,EAAV,CAAd;AAAA,GAAnB,CAAP;AACH;SAEeI,UAAUJ;AACtB,MAAIK,IAAI,GAAG,IAAIC,IAAJ,GAAWC,OAAX,EAAX;;AACA,SAAM,IAAID,IAAJ,GAAWC,OAAX,KAAuBF,IAAI,GAAGL,EAApC,EAAwC;AAEvC;AACJ;;ACPM,IAAMQ,aAAa,GAAG;AACzBC,EAAAA,QAAQ,EAAE,CADe;AAEzBC,EAAAA,QAAQ,EAAE,KAFe;AAGzBC,EAAAA,YAAY,EAAE,EAHW;AAIzBC,EAAAA,aAAa,eAAE,IAAIN,IAAJ,EAJU;AAKzBO,EAAAA,SAAS,EAAE;AAAA,WAAML,aAAa,CAACE,QAAd,GAAyBF,aAAa,CAACG,YAA7C;AAAA,GALc;AAMzBG,EAAAA,YAAY,EAAE,sBAACC,IAAD;AACV,QAAMC,QAAQ,GAAGD,IAAI,CAACR,OAAL,KAAiBC,aAAa,CAACI,aAAd,CAA4BL,OAA5B,EAAlC;AACA,QAAMU,MAAM,GAAGD,QAAQ,GAAER,aAAa,CAACK,SAAd,EAAzB;AACA,QAAMK,QAAQ,GAAG,CAACH,IAAI,CAACR,OAAL,KAAeD,IAAI,CAACa,GAAL,EAAhB,IAA4BF,MAA7C;AACA,WAAOG,IAAI,CAACC,KAAL,CAAWH,QAAX,CAAP;AACH;AAXwB,CAAtB;;SCASI,yBAAyBP;AACrC,MAAG,EAAEA,IAAI,YAAYT,IAAlB,CAAH,EAA2B;AACvB,UAAMiB,SAAS,2CAAyC,OAAOR,IAAhD,CAAf;AACH;;AAED,MAAMG,QAAQ,GAAGV,aAAa,CAACM,YAAd,CAA2BC,IAA3B,CAAjB;AACA,MAAMS,IAAI,GAAGhB,aAAa,CAACE,QAAd,GAAuBQ,QAAQ,GAACV,aAAa,CAACG,YAA3D;AACAc,EAAAA,OAAO,CAACC,GAAR,CAAYF,IAAZ;AACA,SAAOA,IAAP;AACH;;SCNeG,OAAOZ;AACnB,MAAMa,SAAS,GAAGN,wBAAwB,CAACP,IAAD,CAA1C;AACA,SAAOhB,KAAK,CAAC6B,SAAD,CAAZ;AACH;AAED,SAAgBC,WAAWd;AACvB,MAAMa,SAAS,GAAGN,wBAAwB,CAACP,IAAD,CAA1C;AACAX,EAAAA,SAAS,CAACwB,SAAD,CAAT;AACH;AAED,SAAgBE,GAAGC;AACf,MAAMH,SAAS,GAAGG,MAAM,GAAGvB,aAAa,CAACG,YAAzC;AACA,SAAOZ,KAAK,CAAC6B,SAAD,CAAZ;AACH;AAED,SAAgBI,OAAOD;AACnB,MAAMH,SAAS,GAAGG,MAAM,GAAGvB,aAAa,CAACG,YAAzC;AACAP,EAAAA,SAAS,CAACwB,SAAD,CAAT;AACH;;ICpBYK,UAAU,GAAG,SAASA,UAAT;AACtB,SAAO;AACHN,IAAAA,MAAM,EAANA,MADG;AAEHE,IAAAA,UAAU,EAAVA,UAFG;AAGHC,IAAAA,EAAE,EAAFA,EAHG;AAIHE,IAAAA,MAAM,EAANA;AAJG,GAAP;AAMH,CAPM;;;;"}

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

"use strict";
"use strict";function e(e){return new Promise((function(t){return setTimeout(t,e)}))}function t(e){for(var t=(new Date).getTime();(new Date).getTime()<t+e;);}Object.defineProperty(exports,"__esModule",{value:!0});var n={minSleep:0,maxSleep:1e4,intervalSize:50,referenceDate:new Date,intervals:function(){return n.maxSleep/n.intervalSize},findInterval:function(e){var t=(e.getTime()-n.referenceDate.getTime())/n.intervals(),r=(e.getTime()-Date.now())/t;return Math.floor(r)}};function r(e){if(!(e instanceof Date))throw TypeError("Parameter is not of type Date. Found "+typeof e);var t=n.findInterval(e),r=n.maxSleep-t*n.intervalSize;return console.log(r),r}function i(t){return e(r(t))}function o(e){t(r(e))}function a(t){return e(t*n.intervalSize)}function u(e){t(e*n.intervalSize)}exports.deoptimize=function(){return{byDate:i,byDateSync:o,by:a,bySync:u}};
//# sourceMappingURL=deoptimize.cjs.production.min.js.map

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

{"version":3,"file":"deoptimize.cjs.production.min.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
{"version":3,"file":"deoptimize.cjs.production.min.js","sources":["../src/sleep.ts","../src/configuration.ts","../src/util.ts","../src/by.ts","../src/index.ts"],"sourcesContent":["export function sleep(ms:number): Promise<void> {\r\n return new Promise(resolve => setTimeout(resolve, ms));\r\n}\r\n\r\nexport function sleepSync(ms:number){\r\n var stop = new Date().getTime();\r\n while(new Date().getTime() < stop + ms) {\r\n ;\r\n }\r\n}","import {findInterval} from './util';\r\n\r\nexport const configuration = {\r\n minSleep: 0, //minimum sleep in ms\r\n maxSleep: 10000, // maximum sleep in ms\r\n intervalSize: 50, //50ms\r\n referenceDate: new Date(),\r\n intervals: () => configuration.maxSleep / configuration.intervalSize,\r\n findInterval: (date: Date): number => {\r\n const duration = date.getTime() - configuration.referenceDate.getTime();\r\n const period = duration/ configuration.intervals();\r\n const interval = (date.getTime()-Date.now())/period;\r\n return Math.floor(interval);\r\n }\r\n}\r\n","import { configuration } from './configuration';\r\n\r\nexport function computeSleepTimeFromDate(date: Date): number{\r\n if(!(date instanceof Date)){\r\n throw TypeError(`Parameter is not of type Date. Found ${typeof date}`);\r\n }\r\n\r\n const interval = configuration.findInterval(date);\r\n const time = configuration.maxSleep-interval*configuration.intervalSize;\r\n console.log(time)\r\n return time;\r\n}\r\n\r\nexport function findInterval(date: Date): number {\r\n const duration = date.getTime() - configuration.referenceDate.getTime();\r\n const period = duration/ configuration.intervals();\r\n const interval = (date.getTime()-Date.now())/period;\r\n return Math.floor(interval);\r\n}","import {sleep, sleepSync} from './sleep';\r\nimport {computeSleepTimeFromDate} from './util';\r\nimport {configuration} from \"./configuration\";\r\nimport * as http from \"http\";\r\n\r\nexport function byDate(date: Date): Promise<void> {\r\n const sleepTime = computeSleepTimeFromDate(date);\r\n return sleep(sleepTime);\r\n}\r\n\r\nexport function byDateSync(date: Date): void {\r\n const sleepTime = computeSleepTimeFromDate(date);\r\n sleepSync(sleepTime);\r\n}\r\n\r\nexport function by(factor: number): Promise<void> {\r\n const sleepTime = factor * configuration.intervalSize;\r\n return sleep(sleepTime);\r\n}\r\n\r\nexport function bySync(factor: number): void {\r\n const sleepTime = factor * configuration.intervalSize;\r\n sleepSync(sleepTime);\r\n}\r\n\r\n","import {by, byDate, byDateSync, bySync} from './by';\r\n\r\n\r\nexport const deoptimize = function deoptimize() {\r\n return {\r\n byDate,\r\n byDateSync,\r\n by,\r\n bySync\r\n }\r\n};\r\n"],"names":["sleep","ms","Promise","resolve","setTimeout","sleepSync","stop","Date","getTime","configuration","minSleep","maxSleep","intervalSize","referenceDate","intervals","findInterval","date","period","interval","now","Math","floor","computeSleepTimeFromDate","TypeError","time","console","log","byDate","byDateSync","by","factor","bySync"],"mappings":"sBAAgBA,EAAMC,UACX,IAAIC,SAAQ,SAAAC,UAAWC,WAAWD,EAASF,eAGtCI,EAAUJ,WAClBK,GAAO,IAAIC,MAAOC,WAChB,IAAID,MAAOC,UAAYF,EAAOL,4DCJjC,IAAMQ,EAAgB,CACzBC,SAAU,EACVC,SAAU,IACVC,aAAc,GACdC,cAAe,IAAIN,KACnBO,UAAW,kBAAML,EAAcE,SAAWF,EAAcG,cACxDG,aAAc,SAACC,OAELC,GADWD,EAAKR,UAAYC,EAAcI,cAAcL,WACrCC,EAAcK,YACjCI,GAAYF,EAAKR,UAAUD,KAAKY,OAAOF,SACtCG,KAAKC,MAAMH,cCVVI,EAAyBN,QAChCA,aAAgBT,YACXgB,yDAAyDP,OAG7DE,EAAWT,EAAcM,aAAaC,GACtCQ,EAAOf,EAAcE,SAASO,EAAST,EAAcG,oBAC3Da,QAAQC,IAAIF,GACLA,WCLKG,EAAOX,UAEZhB,EADWsB,EAAyBN,aAI/BY,EAAWZ,GAEvBX,EADkBiB,EAAyBN,aAI/Ba,EAAGC,UAER9B,EADW8B,EAASrB,EAAcG,uBAI7BmB,EAAOD,GAEnBzB,EADkByB,EAASrB,EAAcG,iCClBnB,iBACf,CACHe,OAAAA,EACAC,WAAAA,EACAC,GAAAA,EACAE,OAAAA"}

@@ -0,2 +1,67 @@

function sleep(ms) {
return new Promise(function (resolve) {
return setTimeout(resolve, ms);
});
}
function sleepSync(ms) {
var stop = new Date().getTime();
while (new Date().getTime() < stop + ms) {
}
}
var configuration = {
minSleep: 0,
maxSleep: 10000,
intervalSize: 50,
referenceDate: /*#__PURE__*/new Date(),
intervals: function intervals() {
return configuration.maxSleep / configuration.intervalSize;
},
findInterval: function findInterval(date) {
var duration = date.getTime() - configuration.referenceDate.getTime();
var period = duration / configuration.intervals();
var interval = (date.getTime() - Date.now()) / period;
return Math.floor(interval);
}
};
function computeSleepTimeFromDate(date) {
if (!(date instanceof Date)) {
throw TypeError("Parameter is not of type Date. Found " + typeof date);
}
var interval = configuration.findInterval(date);
var time = configuration.maxSleep - interval * configuration.intervalSize;
console.log(time);
return time;
}
function byDate(date) {
var sleepTime = computeSleepTimeFromDate(date);
return sleep(sleepTime);
}
function byDateSync(date) {
var sleepTime = computeSleepTimeFromDate(date);
sleepSync(sleepTime);
}
function by(factor) {
var sleepTime = factor * configuration.intervalSize;
return sleep(sleepTime);
}
function bySync(factor) {
var sleepTime = factor * configuration.intervalSize;
sleepSync(sleepTime);
}
var deoptimize = function deoptimize() {
return {
byDate: byDate,
byDateSync: byDateSync,
by: by,
bySync: bySync
};
};
export { deoptimize };
//# sourceMappingURL=deoptimize.esm.js.map

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

{"version":3,"file":"deoptimize.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
{"version":3,"file":"deoptimize.esm.js","sources":["../src/sleep.ts","../src/configuration.ts","../src/util.ts","../src/by.ts","../src/index.ts"],"sourcesContent":["export function sleep(ms:number): Promise<void> {\r\n return new Promise(resolve => setTimeout(resolve, ms));\r\n}\r\n\r\nexport function sleepSync(ms:number){\r\n var stop = new Date().getTime();\r\n while(new Date().getTime() < stop + ms) {\r\n ;\r\n }\r\n}","import {findInterval} from './util';\r\n\r\nexport const configuration = {\r\n minSleep: 0, //minimum sleep in ms\r\n maxSleep: 10000, // maximum sleep in ms\r\n intervalSize: 50, //50ms\r\n referenceDate: new Date(),\r\n intervals: () => configuration.maxSleep / configuration.intervalSize,\r\n findInterval: (date: Date): number => {\r\n const duration = date.getTime() - configuration.referenceDate.getTime();\r\n const period = duration/ configuration.intervals();\r\n const interval = (date.getTime()-Date.now())/period;\r\n return Math.floor(interval);\r\n }\r\n}\r\n","import { configuration } from './configuration';\r\n\r\nexport function computeSleepTimeFromDate(date: Date): number{\r\n if(!(date instanceof Date)){\r\n throw TypeError(`Parameter is not of type Date. Found ${typeof date}`);\r\n }\r\n\r\n const interval = configuration.findInterval(date);\r\n const time = configuration.maxSleep-interval*configuration.intervalSize;\r\n console.log(time)\r\n return time;\r\n}\r\n\r\nexport function findInterval(date: Date): number {\r\n const duration = date.getTime() - configuration.referenceDate.getTime();\r\n const period = duration/ configuration.intervals();\r\n const interval = (date.getTime()-Date.now())/period;\r\n return Math.floor(interval);\r\n}","import {sleep, sleepSync} from './sleep';\r\nimport {computeSleepTimeFromDate} from './util';\r\nimport {configuration} from \"./configuration\";\r\nimport * as http from \"http\";\r\n\r\nexport function byDate(date: Date): Promise<void> {\r\n const sleepTime = computeSleepTimeFromDate(date);\r\n return sleep(sleepTime);\r\n}\r\n\r\nexport function byDateSync(date: Date): void {\r\n const sleepTime = computeSleepTimeFromDate(date);\r\n sleepSync(sleepTime);\r\n}\r\n\r\nexport function by(factor: number): Promise<void> {\r\n const sleepTime = factor * configuration.intervalSize;\r\n return sleep(sleepTime);\r\n}\r\n\r\nexport function bySync(factor: number): void {\r\n const sleepTime = factor * configuration.intervalSize;\r\n sleepSync(sleepTime);\r\n}\r\n\r\n","import {by, byDate, byDateSync, bySync} from './by';\r\n\r\n\r\nexport const deoptimize = function deoptimize() {\r\n return {\r\n byDate,\r\n byDateSync,\r\n by,\r\n bySync\r\n }\r\n};\r\n"],"names":["sleep","ms","Promise","resolve","setTimeout","sleepSync","stop","Date","getTime","configuration","minSleep","maxSleep","intervalSize","referenceDate","intervals","findInterval","date","duration","period","interval","now","Math","floor","computeSleepTimeFromDate","TypeError","time","console","log","byDate","sleepTime","byDateSync","by","factor","bySync","deoptimize"],"mappings":"SAAgBA,MAAMC;AAClB,SAAO,IAAIC,OAAJ,CAAY,UAAAC,OAAO;AAAA,WAAIC,UAAU,CAACD,OAAD,EAAUF,EAAV,CAAd;AAAA,GAAnB,CAAP;AACH;SAEeI,UAAUJ;AACtB,MAAIK,IAAI,GAAG,IAAIC,IAAJ,GAAWC,OAAX,EAAX;;AACA,SAAM,IAAID,IAAJ,GAAWC,OAAX,KAAuBF,IAAI,GAAGL,EAApC,EAAwC;AAEvC;AACJ;;ACPM,IAAMQ,aAAa,GAAG;AACzBC,EAAAA,QAAQ,EAAE,CADe;AAEzBC,EAAAA,QAAQ,EAAE,KAFe;AAGzBC,EAAAA,YAAY,EAAE,EAHW;AAIzBC,EAAAA,aAAa,eAAE,IAAIN,IAAJ,EAJU;AAKzBO,EAAAA,SAAS,EAAE;AAAA,WAAML,aAAa,CAACE,QAAd,GAAyBF,aAAa,CAACG,YAA7C;AAAA,GALc;AAMzBG,EAAAA,YAAY,EAAE,sBAACC,IAAD;AACV,QAAMC,QAAQ,GAAGD,IAAI,CAACR,OAAL,KAAiBC,aAAa,CAACI,aAAd,CAA4BL,OAA5B,EAAlC;AACA,QAAMU,MAAM,GAAGD,QAAQ,GAAER,aAAa,CAACK,SAAd,EAAzB;AACA,QAAMK,QAAQ,GAAG,CAACH,IAAI,CAACR,OAAL,KAAeD,IAAI,CAACa,GAAL,EAAhB,IAA4BF,MAA7C;AACA,WAAOG,IAAI,CAACC,KAAL,CAAWH,QAAX,CAAP;AACH;AAXwB,CAAtB;;SCASI,yBAAyBP;AACrC,MAAG,EAAEA,IAAI,YAAYT,IAAlB,CAAH,EAA2B;AACvB,UAAMiB,SAAS,2CAAyC,OAAOR,IAAhD,CAAf;AACH;;AAED,MAAMG,QAAQ,GAAGV,aAAa,CAACM,YAAd,CAA2BC,IAA3B,CAAjB;AACA,MAAMS,IAAI,GAAGhB,aAAa,CAACE,QAAd,GAAuBQ,QAAQ,GAACV,aAAa,CAACG,YAA3D;AACAc,EAAAA,OAAO,CAACC,GAAR,CAAYF,IAAZ;AACA,SAAOA,IAAP;AACH;;SCNeG,OAAOZ;AACnB,MAAMa,SAAS,GAAGN,wBAAwB,CAACP,IAAD,CAA1C;AACA,SAAOhB,KAAK,CAAC6B,SAAD,CAAZ;AACH;AAED,SAAgBC,WAAWd;AACvB,MAAMa,SAAS,GAAGN,wBAAwB,CAACP,IAAD,CAA1C;AACAX,EAAAA,SAAS,CAACwB,SAAD,CAAT;AACH;AAED,SAAgBE,GAAGC;AACf,MAAMH,SAAS,GAAGG,MAAM,GAAGvB,aAAa,CAACG,YAAzC;AACA,SAAOZ,KAAK,CAAC6B,SAAD,CAAZ;AACH;AAED,SAAgBI,OAAOD;AACnB,MAAMH,SAAS,GAAGG,MAAM,GAAGvB,aAAa,CAACG,YAAzC;AACAP,EAAAA,SAAS,CAACwB,SAAD,CAAT;AACH;;ICpBYK,UAAU,GAAG,SAASA,UAAT;AACtB,SAAO;AACHN,IAAAA,MAAM,EAANA,MADG;AAEHE,IAAAA,UAAU,EAAVA,UAFG;AAGHC,IAAAA,EAAE,EAAFA,EAHG;AAIHE,IAAAA,MAAM,EAANA;AAJG,GAAP;AAMH,CAPM;;;;"}

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

export declare function sleep(ms: number): Promise<unknown>;
export declare function sleep(ms: number): Promise<void>;
export declare function sleepSync(ms: number): void;
{
"version": "0.1.0",
"version": "0.1.1",
"license": "MIT",

@@ -14,3 +14,4 @@ "main": "dist/index.js",

"scripts": {
"start": "tsdx watch",
"start": "node dist/index.js",
"watch": "tsdx watch",
"build": "tsdx build",

@@ -48,2 +49,6 @@ "test": "tsdx test",

],
"repository": {
"type": "git",
"url": "https://github.com/precupstefan/deoptimize"
},
"devDependencies": {

@@ -56,3 +61,5 @@ "@size-limit/preset-small-lib": "^4.7.0",

"typescript": "^4.0.5"
},
"dependencies": {
}
}
+1
-103

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

# TSDX User Guide
Congrats! You just saved yourself hours of work by bootstrapping this project with TSDX. Let’s get you oriented with what’s here and how to use it.
> This TSDX setup is meant for developing libraries (not apps!) that can be published to NPM. If you’re looking to build a Node app, you could use `ts-node-dev`, plain `ts-node`, or simple `tsc`.
> If you’re new to TypeScript, checkout [this handy cheatsheet](https://devhints.io/typescript)
## Commands
TSDX scaffolds your new library inside `/src`.
To run TSDX, use:
```bash
npm start # or yarn start
```
This builds to `/dist` and runs the project in watch mode so any edits you save inside `src` causes a rebuild to `/dist`.
To do a one-off build, use `npm run build` or `yarn build`.
To run tests, use `npm test` or `yarn test`.
## Configuration
Code quality is set up for you with `prettier`, `husky`, and `lint-staged`. Adjust the respective fields in `package.json` accordingly.
### Jest
Jest tests are set up to run with `npm test` or `yarn test`.
### Bundle Analysis
[`size-limit`](https://github.com/ai/size-limit) is set up to calculate the real cost of your library with `npm run size` and visualize the bundle with `npm run analyze`.
#### Setup Files
This is the folder structure we set up for you:
```txt
/src
index.tsx # EDIT THIS
/test
blah.test.tsx # EDIT THIS
.gitignore
package.json
README.md # EDIT THIS
tsconfig.json
```
### Rollup
TSDX uses [Rollup](https://rollupjs.org) as a bundler and generates multiple rollup configs for various module formats and build settings. See [Optimizations](#optimizations) for details.
### TypeScript
`tsconfig.json` is set up to interpret `dom` and `esnext` types, as well as `react` for `jsx`. Adjust according to your needs.
## Continuous Integration
### GitHub Actions
Two actions are added by default:
- `main` which installs deps w/ cache, lints, tests, and builds on all pushes against a Node and OS matrix
- `size` which comments cost comparison of your library on every pull request using [`size-limit`](https://github.com/ai/size-limit)
## Optimizations
Please see the main `tsdx` [optimizations docs](https://github.com/palmerhq/tsdx#optimizations). In particular, know that you can take advantage of development-only optimizations:
```js
// ./types/index.d.ts
declare var __DEV__: boolean;
// inside your code...
if (__DEV__) {
console.log('foo');
}
```
You can also choose to install and use [invariant](https://github.com/palmerhq/tsdx#invariant) and [warning](https://github.com/palmerhq/tsdx#warning) functions.
## Module Formats
CJS, ESModules, and UMD module formats are supported.
The appropriate paths are configured in `package.json` and `dist/index.js` accordingly. Please report if any issues are found.
## Named Exports
Per Palmer Group guidelines, [always use named exports.](https://github.com/palmerhq/typescript#exports) Code split inside your React app instead of your React library.
## Including Styles
There are many ways to ship styles, including with CSS-in-JS. TSDX has no opinion on this, configure how you like.
For vanilla CSS, you can include it at the root directory and add it to the `files` section in your `package.json`, so that it can be imported separately by your users and run through their bundler's loader.
## Publishing to NPM
We recommend using [np](https://github.com/sindresorhus/np).
This is a work in progress project. README will be updated as soon as this project will be complete

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

export function sleep(ms:number) {
export function sleep(ms:number): Promise<void> {
return new Promise(resolve => setTimeout(resolve, ms));

@@ -3,0 +3,0 @@ }