Breaking down mega-package. Hello auth-db 1.0.0!

This commit is contained in:
2023-05-23 14:15:34 -04:00
commit 2d341e5a9a
33 changed files with 641 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
export const parseTimeoutToMs = (timeout: string) => {
const match = timeout.match(/(?<number>\d+)(?<unit>d|h|m)/gi)?.groups || {};
const { number, unit } = match;
switch (unit) {
case 'd':
return 1000 * 60 * 60 * 24 * parseInt(number);
case 'h':
return 1000 * 60 * 60 * parseInt(number);
case 'm':
default:
return 1000 * 60 * parseInt(number) || 1;
}
};