From 06f671ddd7b0588ed6a7c5fdf044be30818c0052 Mon Sep 17 00:00:00 2001 From: hyperz111 Date: Fri, 7 Nov 2025 15:54:50 +0700 Subject: [PATCH 1/3] inlining ms --- src/common.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/common.js b/src/common.js index 141cb578..f91a4537 100644 --- a/src/common.js +++ b/src/common.js @@ -11,7 +11,7 @@ function setup(env) { createDebug.disable = disable; createDebug.enable = enable; createDebug.enabled = enabled; - createDebug.humanize = require('ms'); + createDebug.humanize = humanize; createDebug.destroy = destroy; Object.keys(env).forEach(key => { @@ -284,6 +284,23 @@ function setup(env) { console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'); } + const s = 1000; + const m = s * 60; + const h = m * 60; + + function humanize(diff) { + if (diff >= h) { + return Math.round(diff / h) + 'h'; + } + if (diff >= m) { + return Math.round(diff / m) + 'm'; + } + if (diff >= s) { + return Math.round(diff / s) + 's'; + } + return diff + 'ms'; + } + createDebug.enable(createDebug.load()); return createDebug; From 7944066c8147eebe2feb44ec863fc757cd151b97 Mon Sep 17 00:00:00 2001 From: hyperz111 Date: Fri, 7 Nov 2025 15:56:41 +0700 Subject: [PATCH 2/3] remove ms --- package.json | 3 --- 1 file changed, 3 deletions(-) diff --git a/package.json b/package.json index ee8abb52..e3f325cf 100644 --- a/package.json +++ b/package.json @@ -30,9 +30,6 @@ "test:browser": "karma start --single-run", "test:coverage": "cat ./coverage/lcov.info | coveralls" }, - "dependencies": { - "ms": "^2.1.3" - }, "devDependencies": { "brfs": "^2.0.1", "browserify": "^16.2.3", From 5a10e562aab9064a878c2caac7715751270e05f2 Mon Sep 17 00:00:00 2001 From: hyperz111 Date: Fri, 14 Nov 2025 13:53:25 +0700 Subject: [PATCH 3/3] remove to hours --- src/common.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/common.js b/src/common.js index f91a4537..11e3d09a 100644 --- a/src/common.js +++ b/src/common.js @@ -286,12 +286,8 @@ function setup(env) { const s = 1000; const m = s * 60; - const h = m * 60; function humanize(diff) { - if (diff >= h) { - return Math.round(diff / h) + 'h'; - } if (diff >= m) { return Math.round(diff / m) + 'm'; }