@statx/utils
Advanced tools
| export declare const throttled: <F extends (...args: any[]) => any>(time: number, df: F) => F; |
| exports.throttled=(t,e)=>{let l,n,o=0;const c=function(){var r=[].slice.call(arguments);const s=Date.now(),u=s-o;u>t?(e(...r),o=s):(n=r,l||(l=setTimeout(()=>{c(n),l=null},u)))};return c}; | ||
| //# sourceMappingURL=index.js.map |
| {"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["export const throttled = /*#__PURE__*/ <F extends (...args: any[]) => any>(time: number, df: F): F => {\r\n let timer: any\r\n let lastArgs: any[]\r\n let lastCall = 0\r\n\r\n const f = ((...args) => {\r\n const currtime = Date.now()\r\n const diffTime = currtime - lastCall\r\n if (diffTime > time) {\r\n df(...args)\r\n lastCall = currtime\r\n } else {\r\n lastArgs = args\r\n if (!timer) {\r\n timer = setTimeout(() => {\r\n f(lastArgs)\r\n timer = null\r\n }, diffTime)\r\n }\r\n }\r\n }) as F\r\n\r\n return f\r\n}\r\n"],"names":["time","df","f","slice","call","arguments","Date","now","diffTime","currtime","lastCall","args","lastArgs","timer","setTimeout"],"mappings":"kBAAuC,CAAoCA,EAAcC,KACvF,UAEe,EAEf,MAAMC,EAAK,WAAY,MACrB,GAAAC,MAAAC,KAAAC,WAAA,QAAiBC,KAAKC,MAChBC,EAAWC,EAAWC,EACxBF,EAAWR,GACbC,KAAMU,GACND,EAAWD,IAEXG,EAAWD,EACNE,IACHA,EAAQC,WAAW,KACjBZ,EAAEU,GACFC,EAAQ,IAAA,EACPL,IAGT,EAEA,OAAON"} |
| const t=(t,e)=>{let n,o,s=0;const c=(...l)=>{const r=Date.now(),u=r-s;u>t?(e(...l),s=r):(o=l,n||(n=setTimeout(()=>{c(o),n=null},u)))};return c};export{t as throttled}; | ||
| //# sourceMappingURL=index.modern.mjs.map |
| {"version":3,"file":"index.modern.mjs","sources":["../src/index.ts"],"sourcesContent":["export const throttled = /*#__PURE__*/ <F extends (...args: any[]) => any>(time: number, df: F): F => {\r\n let timer: any\r\n let lastArgs: any[]\r\n let lastCall = 0\r\n\r\n const f = ((...args) => {\r\n const currtime = Date.now()\r\n const diffTime = currtime - lastCall\r\n if (diffTime > time) {\r\n df(...args)\r\n lastCall = currtime\r\n } else {\r\n lastArgs = args\r\n if (!timer) {\r\n timer = setTimeout(() => {\r\n f(lastArgs)\r\n timer = null\r\n }, diffTime)\r\n }\r\n }\r\n }) as F\r\n\r\n return f\r\n}\r\n"],"names":["throttled","time","df","f","args","currtime","Date","now","lastCall","diffTime","lastArgs","timer","setTimeout"],"mappings":"AAAaA,QAA0B,CAAoCC,EAAcC,KACvF,UAEe,EAEf,MAAMC,EAAK,IAAIC,KACb,MAAcC,EAAGC,KAAKC,QACLF,EAAWG,EACxBC,EAAWR,GACbC,KAAME,GACNI,EAAWH,IAEXK,EAAWN,EACNO,IACHA,EAAQC,WAAW,KACjBT,EAAEO,GACFC,EAAQ,MACPF,IAEN,EAGH,OAAON"} |
| const t=(t,n)=>{let e,o,c=0;const l=function(){var s=[].slice.call(arguments);const r=Date.now(),u=r-c;u>t?(n(...s),c=r):(o=s,e||(e=setTimeout(()=>{l(o),e=null},u)))};return l};export{t as throttled}; | ||
| //# sourceMappingURL=index.module.js.map |
| {"version":3,"file":"index.module.js","sources":["../src/index.ts"],"sourcesContent":["export const throttled = /*#__PURE__*/ <F extends (...args: any[]) => any>(time: number, df: F): F => {\r\n let timer: any\r\n let lastArgs: any[]\r\n let lastCall = 0\r\n\r\n const f = ((...args) => {\r\n const currtime = Date.now()\r\n const diffTime = currtime - lastCall\r\n if (diffTime > time) {\r\n df(...args)\r\n lastCall = currtime\r\n } else {\r\n lastArgs = args\r\n if (!timer) {\r\n timer = setTimeout(() => {\r\n f(lastArgs)\r\n timer = null\r\n }, diffTime)\r\n }\r\n }\r\n }) as F\r\n\r\n return f\r\n}\r\n"],"names":["throttled","time","df","f","slice","call","arguments","Date","now","diffTime","currtime","lastCall","args","lastArgs","timer","setTimeout"],"mappings":"AAAaA,QAA0B,CAAoCC,EAAcC,KACvF,UAEe,EAEf,MAAMC,EAAK,WAAY,MACrB,GAAAC,MAAAC,KAAAC,WAAA,QAAiBC,KAAKC,MAChBC,EAAWC,EAAWC,EACxBF,EAAWR,GACbC,KAAMU,GACND,EAAWD,IAEXG,EAAWD,EACNE,IACHA,EAAQC,WAAW,KACjBZ,EAAEU,GACFC,EAAQ,IAAA,EACPL,IAGT,EAEA,OAAON"} |
| !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e||self).utils={})}(this,function(e){e.throttled=(e,t)=>{let n,o,i=0;const f=function(){var l=[].slice.call(arguments);const s=Date.now(),u=s-i;u>e?(t(...l),i=s):(o=l,n||(n=setTimeout(()=>{f(o),n=null},u)))};return f}}); | ||
| //# sourceMappingURL=index.umd.js.map |
| {"version":3,"file":"index.umd.js","sources":["../src/index.ts"],"sourcesContent":["export const throttled = /*#__PURE__*/ <F extends (...args: any[]) => any>(time: number, df: F): F => {\r\n let timer: any\r\n let lastArgs: any[]\r\n let lastCall = 0\r\n\r\n const f = ((...args) => {\r\n const currtime = Date.now()\r\n const diffTime = currtime - lastCall\r\n if (diffTime > time) {\r\n df(...args)\r\n lastCall = currtime\r\n } else {\r\n lastArgs = args\r\n if (!timer) {\r\n timer = setTimeout(() => {\r\n f(lastArgs)\r\n timer = null\r\n }, diffTime)\r\n }\r\n }\r\n }) as F\r\n\r\n return f\r\n}\r\n"],"names":["time","df","f","slice","call","arguments","Date","now","diffTime","currtime","lastCall","args","lastArgs","timer","setTimeout"],"mappings":"2OAAuC,CAAoCA,EAAcC,KACvF,UAEe,EAEf,MAAMC,EAAK,WAAY,MACrB,GAAAC,MAAAC,KAAAC,WAAA,QAAiBC,KAAKC,MAChBC,EAAWC,EAAWC,EACxBF,EAAWR,GACbC,KAAMU,GACND,EAAWD,IAEXG,EAAWD,EACNE,IACHA,EAAQC,WAAW,KACjBZ,EAAEU,GACFC,EAAQ,IAAA,EACPL,IAGT,EAEA,OAAON"} |
+3
-2
| { | ||
| "name": "@statx/utils", | ||
| "version": "1.1.0", | ||
| "version": "1.1.1", | ||
| "private": false, | ||
@@ -37,2 +37,3 @@ "description": "Extry tiny smart statx manager", | ||
| "files": [ | ||
| "/build", | ||
| "/package.json", | ||
@@ -63,3 +64,3 @@ "/README.md", | ||
| }, | ||
| "gitHead": "0c3f0bee1aaed49928d9c1813d81e9c611a1ca87" | ||
| "gitHead": "1bcd35b45ca323a401ef0a3aaee075c0f00e2595" | ||
| } |
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 2 instances in 1 package
9043
152.74%15
150%39
34.48%4
300%