{"code":"/**\r\n * Throttles the input promise for a given amount of miliseconds\r\n */\r\nconst throttle = (ms, promise) => new Promise(async (resolve, reject) => {\r\n    const sleep = new Promise(resolve => setTimeout(resolve, ms));\r\n    if (!promise)\r\n        return resolve(await sleep);\r\n    try {\r\n        const [res] = await Promise.all([promise, sleep]);\r\n        return resolve(res);\r\n    }\r\n    catch (err) {\r\n        return reject(err);\r\n    }\r\n});\r\nexport default throttle;\r\n//# sourceMappingURL=index.js.map","map":"{\"version\":3,\"file\":\"index.js\",\"sourceRoot\":\"\",\"sources\":[\"../../../../src/async/throttle/index.ts\"],\"names\":[],\"mappings\":\"AAAA;;GAEG;AACH,MAAM,QAAQ,GAAG,CAAC,EAAU,EAAE,OAAqB,EAAE,EAAE,CAAC,IAAI,OAAO,CACjE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE;IACxB,MAAM,KAAK,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;IAE9D,IAAI,CAAC,OAAO;QAAE,OAAO,OAAO,CAAC,MAAM,KAAK,CAAC,CAAC;IAE1C,IAAI;QACF,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;QAClD,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC;KACrB;IAAC,OAAO,GAAG,EAAE;QACZ,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;KACpB;AACH,CAAC,CACF,CAAC;AAEF,eAAe,QAAQ,CAAC\"}","dts":{"name":"/Users/thibault/Development/pure-fun/async/throttle/index.d.ts","writeByteOrderMark":false,"text":"/**\r\n * Throttles the input promise for a given amount of miliseconds\r\n */\r\ndeclare const throttle: (ms: number, promise: Promise<any>) => Promise<{}>;\r\nexport default throttle;\r\n"}}
