MCPcopy
hub / github.com/di-sukharev/opencommit / "node_modules/ms/index.js"

Function "node_modules/ms/index.js"

out/cli.cjs:9255–9366  ·  view source on GitHub ↗
(exports2, module2)

Source from the content-addressed store, hash-verified

9253// node_modules/ms/index.js
9254var require_ms = __commonJS({
9255 "node_modules/ms/index.js"(exports2, module2) {
9256 var s2 = 1e3;
9257 var m5 = s2 * 60;
9258 var h4 = m5 * 60;
9259 var d7 = h4 * 24;
9260 var w7 = d7 * 7;
9261 var y6 = d7 * 365.25;
9262 module2.exports = function(val, options) {
9263 options = options || {};
9264 var type2 = typeof val;
9265 if (type2 === "string" && val.length > 0) {
9266 return parse(val);
9267 } else if (type2 === "number" && isFinite(val)) {
9268 return options.long ? fmtLong(val) : fmtShort(val);
9269 }
9270 throw new Error(
9271 "val is not a non-empty string or a valid number. val=" + JSON.stringify(val)
9272 );
9273 };
9274 function parse(str2) {
9275 str2 = String(str2);
9276 if (str2.length > 100) {
9277 return;
9278 }
9279 var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
9280 str2
9281 );
9282 if (!match) {
9283 return;
9284 }
9285 var n2 = parseFloat(match[1]);
9286 var type2 = (match[2] || "ms").toLowerCase();
9287 switch (type2) {
9288 case "years":
9289 case "year":
9290 case "yrs":
9291 case "yr":
9292 case "y":
9293 return n2 * y6;
9294 case "weeks":
9295 case "week":
9296 case "w":
9297 return n2 * w7;
9298 case "days":
9299 case "day":
9300 case "d":
9301 return n2 * d7;
9302 case "hours":
9303 case "hour":
9304 case "hrs":
9305 case "hr":
9306 case "h":
9307 return n2 * h4;
9308 case "minutes":
9309 case "minute":
9310 case "mins":
9311 case "min":
9312 case "m":

Callers

nothing calls this directly

Calls 3

parseFunction · 0.85
fmtLongFunction · 0.85
fmtShortFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…