@choksheak/ts-utils 0.3.5 → 0.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/arrayBuffer.cjs +10 -39
- package/arrayBuffer.min.cjs +1 -1
- package/arrayBuffer.min.cjs.map +1 -1
- package/arrayBuffer.min.mjs +1 -1
- package/arrayBuffer.min.mjs.map +1 -1
- package/arrayBuffer.mjs +7 -10
- package/asNumber.cjs +6 -38
- package/asNumber.min.cjs +1 -1
- package/asNumber.min.cjs.map +1 -1
- package/asNumber.min.mjs +1 -1
- package/asNumber.min.mjs.map +1 -1
- package/asNumber.mjs +4 -11
- package/assert.cjs +4 -27
- package/assert.min.cjs +1 -1
- package/assert.min.cjs.map +1 -1
- package/assert.min.mjs +1 -1
- package/assert.min.mjs.map +1 -1
- package/assert.mjs +2 -0
- package/base64Url.cjs +5 -29
- package/base64Url.min.cjs +1 -1
- package/base64Url.min.cjs.map +1 -1
- package/base64Url.min.mjs +1 -1
- package/base64Url.min.mjs.map +1 -1
- package/base64Url.mjs +2 -0
- package/capLength.cjs +7 -71
- package/capLength.min.cjs +1 -5
- package/capLength.min.cjs.map +1 -1
- package/capLength.min.mjs +1 -5
- package/capLength.min.mjs.map +1 -1
- package/capLength.mjs +4 -41
- package/chunk-22JDWCOS.min.cjs +2 -0
- package/chunk-22JDWCOS.min.cjs.map +1 -0
- package/chunk-244NBT4Q.min.mjs +2 -0
- package/chunk-244NBT4Q.min.mjs.map +1 -0
- package/chunk-27MBP3ES.min.cjs +2 -0
- package/chunk-27MBP3ES.min.cjs.map +1 -0
- package/chunk-34ENP2B3.min.mjs +438 -0
- package/chunk-34ENP2B3.min.mjs.map +1 -0
- package/chunk-3EBQ2GO2.min.cjs +2 -0
- package/chunk-3EBQ2GO2.min.cjs.map +1 -0
- package/chunk-4GLOLTJ5.cjs +167 -0
- package/chunk-6TQBMXTL.min.cjs +2 -0
- package/chunk-6TQBMXTL.min.cjs.map +1 -0
- package/chunk-AWZBCFMG.min.cjs +2 -0
- package/chunk-AWZBCFMG.min.cjs.map +1 -0
- package/chunk-AXNETZET.cjs +20 -0
- package/chunk-BKZM6NWX.min.cjs +2 -0
- package/chunk-BKZM6NWX.min.cjs.map +1 -0
- package/chunk-BZKQXX3A.cjs +40 -0
- package/chunk-CERFUU5I.cjs +93 -0
- package/chunk-CSTKFJ6G.mjs +239 -0
- package/chunk-DUN4UY2Q.cjs +239 -0
- package/chunk-EDJJUP4K.min.cjs +6 -0
- package/chunk-EDJJUP4K.min.cjs.map +1 -0
- package/chunk-FFNQBZH5.cjs +14 -0
- package/chunk-FZZRSHSH.min.mjs +6 -0
- package/chunk-FZZRSHSH.min.mjs.map +1 -0
- package/chunk-GAP2HS5M.min.cjs +2 -0
- package/chunk-GAP2HS5M.min.cjs.map +1 -0
- package/chunk-GLYMAPS4.min.mjs +2 -0
- package/chunk-GLYMAPS4.min.mjs.map +1 -0
- package/chunk-I65KPVMO.min.cjs +438 -0
- package/chunk-I65KPVMO.min.cjs.map +1 -0
- package/chunk-ILGTU46T.cjs +39 -0
- package/chunk-IOKRXHKE.min.mjs +2 -0
- package/chunk-IOKRXHKE.min.mjs.map +1 -0
- package/chunk-ISP4SMRC.min.cjs +2 -0
- package/chunk-ISP4SMRC.min.cjs.map +1 -0
- package/chunk-KETP5HBF.cjs +24 -0
- package/chunk-KLHNGJ4Y.min.mjs +2 -0
- package/chunk-KLHNGJ4Y.min.mjs.map +1 -0
- package/chunk-KMNTU3DJ.mjs +45 -0
- package/chunk-LDVEXETI.cjs +45 -0
- package/chunk-LZENHV35.min.cjs +2 -0
- package/chunk-LZENHV35.min.cjs.map +1 -0
- package/chunk-M5PIM2HB.mjs +42 -0
- package/chunk-M6PYQYOX.mjs +39 -0
- package/chunk-MN5EYNZN.min.mjs +2 -0
- package/chunk-MN5EYNZN.min.mjs.map +1 -0
- package/chunk-NRIBJ2OJ.mjs +16031 -0
- package/chunk-NVLYXWLX.cjs +32 -0
- package/chunk-O352F2MT.mjs +24 -0
- package/chunk-O6B2TKFK.min.mjs +2 -0
- package/chunk-O6B2TKFK.min.mjs.map +1 -0
- package/chunk-OGF34H4T.min.cjs +2 -0
- package/chunk-OGF34H4T.min.cjs.map +1 -0
- package/chunk-OXSWWWOM.min.mjs +2 -0
- package/chunk-OXSWWWOM.min.mjs.map +1 -0
- package/chunk-PRUGHVRT.mjs +14 -0
- package/chunk-Q4WCMSOW.min.mjs +2 -0
- package/chunk-Q4WCMSOW.min.mjs.map +1 -0
- package/chunk-QH74JZCK.mjs +9 -0
- package/chunk-QNNJNLGK.min.cjs +2 -0
- package/chunk-QNNJNLGK.min.cjs.map +1 -0
- package/chunk-QWCFN7ZM.mjs +15 -0
- package/chunk-SDM2OPT6.mjs +32 -0
- package/chunk-SHKRZCF2.cjs +16031 -0
- package/chunk-SJDJDNDN.min.cjs +2 -0
- package/chunk-SJDJDNDN.min.cjs.map +1 -0
- package/chunk-SULNMALN.cjs +328 -0
- package/chunk-SV35RBZ7.min.mjs +2 -0
- package/chunk-SV35RBZ7.min.mjs.map +1 -0
- package/chunk-TJFYGFOW.mjs +328 -0
- package/chunk-UHRYBUUX.min.mjs +2 -0
- package/chunk-UHRYBUUX.min.mjs.map +1 -0
- package/chunk-UOU6IP3S.min.mjs +2 -0
- package/chunk-UOU6IP3S.min.mjs.map +1 -0
- package/chunk-V76XVNZ5.mjs +20 -0
- package/chunk-VFYQ7I5V.min.mjs +2 -0
- package/chunk-VFYQ7I5V.min.mjs.map +1 -0
- package/chunk-VG7VV7J2.mjs +167 -0
- package/chunk-VJCV56DO.cjs +15 -0
- package/chunk-VREA6AKG.cjs +9 -0
- package/chunk-W5I6Y5FK.min.mjs +2 -0
- package/chunk-W5I6Y5FK.min.mjs.map +1 -0
- package/chunk-Y7MC73BZ.cjs +42 -0
- package/chunk-YVWROQKU.mjs +40 -0
- package/chunk-ZKIZ5SWK.min.cjs +2 -0
- package/chunk-ZKIZ5SWK.min.cjs.map +1 -0
- package/chunk-ZZZB7NJX.mjs +93 -0
- package/concatIterators.cjs +4 -27
- package/concatIterators.min.cjs +1 -1
- package/concatIterators.min.cjs.map +1 -1
- package/concatIterators.min.mjs +1 -1
- package/concatIterators.min.mjs.map +1 -1
- package/concatIterators.mjs +2 -0
- package/dateTimeStr.cjs +31 -119
- package/dateTimeStr.min.cjs +1 -1
- package/dateTimeStr.min.cjs.map +1 -1
- package/dateTimeStr.min.mjs +1 -1
- package/dateTimeStr.min.mjs.map +1 -1
- package/dateTimeStr.mjs +17 -69
- package/duration.cjs +24 -188
- package/duration.min.cjs +1 -1
- package/duration.min.cjs.map +1 -1
- package/duration.min.mjs +1 -1
- package/duration.min.mjs.map +1 -1
- package/duration.mjs +14 -144
- package/getEnv.cjs +20 -0
- package/getEnv.d.mts +11 -0
- package/getEnv.d.ts +11 -0
- package/getEnv.min.cjs +2 -0
- package/getEnv.min.cjs.map +1 -0
- package/getEnv.min.mjs +2 -0
- package/getEnv.min.mjs.map +1 -0
- package/getEnv.mjs +20 -0
- package/isEmpty.cjs +8 -46
- package/isEmpty.min.cjs +1 -1
- package/isEmpty.min.cjs.map +1 -1
- package/isEmpty.min.mjs +1 -1
- package/isEmpty.min.mjs.map +1 -1
- package/isEmpty.mjs +6 -19
- package/isPromise.cjs +5 -29
- package/isPromise.min.cjs +1 -1
- package/isPromise.min.cjs.map +1 -1
- package/isPromise.min.mjs +1 -1
- package/isPromise.min.mjs.map +1 -1
- package/isPromise.mjs +2 -0
- package/kvStore.cjs +15 -353
- package/kvStore.min.cjs +1 -1
- package/kvStore.min.cjs.map +1 -1
- package/kvStore.min.mjs +1 -1
- package/kvStore.min.mjs.map +1 -1
- package/kvStore.mjs +12 -319
- package/localStore.cjs +15 -264
- package/localStore.min.cjs +1 -1
- package/localStore.min.cjs.map +1 -1
- package/localStore.min.mjs +1 -1
- package/localStore.min.mjs.map +1 -1
- package/localStore.mjs +12 -230
- package/magic-string.es-4UY437WL.min.mjs +14 -0
- package/magic-string.es-4UY437WL.min.mjs.map +1 -0
- package/magic-string.es-OAQWZQTY.mjs +1323 -0
- package/magic-string.es-UE2UVQEL.cjs +1323 -0
- package/magic-string.es-X6DNUB6Y.min.cjs +14 -0
- package/magic-string.es-X6DNUB6Y.min.cjs.map +1 -0
- package/mean.cjs +8 -48
- package/mean.min.cjs +1 -1
- package/mean.min.cjs.map +1 -1
- package/mean.min.mjs +1 -1
- package/mean.min.mjs.map +1 -1
- package/mean.mjs +5 -18
- package/median.cjs +7 -41
- package/median.min.cjs +1 -1
- package/median.min.cjs.map +1 -1
- package/median.min.mjs +1 -1
- package/median.min.mjs.map +1 -1
- package/median.mjs +4 -11
- package/nonEmpty.cjs +8 -48
- package/nonEmpty.min.cjs +1 -1
- package/nonEmpty.min.cjs.map +1 -1
- package/nonEmpty.min.mjs +1 -1
- package/nonEmpty.min.mjs.map +1 -1
- package/nonEmpty.mjs +6 -19
- package/nonNil.cjs +4 -27
- package/nonNil.min.cjs +1 -1
- package/nonNil.min.cjs.map +1 -1
- package/nonNil.min.mjs +1 -1
- package/nonNil.min.mjs.map +1 -1
- package/nonNil.mjs +2 -0
- package/package.json +273 -1
- package/round.cjs +6 -32
- package/round.min.cjs +1 -1
- package/round.min.cjs.map +1 -1
- package/round.min.mjs +1 -1
- package/round.min.mjs.map +1 -1
- package/round.mjs +4 -5
- package/roundToString.cjs +7 -35
- package/roundToString.min.cjs +1 -1
- package/roundToString.min.cjs.map +1 -1
- package/roundToString.min.mjs +1 -1
- package/roundToString.min.mjs.map +1 -1
- package/roundToString.mjs +4 -5
- package/safeBtoa.cjs +4 -27
- package/safeBtoa.min.cjs +1 -1
- package/safeBtoa.min.cjs.map +1 -1
- package/safeBtoa.min.mjs +1 -1
- package/safeBtoa.min.mjs.map +1 -1
- package/safeBtoa.mjs +2 -0
- package/sha256.cjs +8 -34
- package/sha256.min.cjs +1 -1
- package/sha256.min.cjs.map +1 -1
- package/sha256.min.mjs +1 -1
- package/sha256.min.mjs.map +1 -1
- package/sha256.mjs +6 -7
- package/sleep.cjs +4 -27
- package/sleep.min.cjs +1 -1
- package/sleep.min.cjs.map +1 -1
- package/sleep.min.mjs +1 -1
- package/sleep.min.mjs.map +1 -1
- package/sleep.mjs +2 -0
- package/storageAdapter.cjs +1 -18
- package/storageAdapter.min.cjs +1 -2
- package/storageAdapter.min.cjs.map +1 -1
- package/sum.cjs +5 -45
- package/sum.min.cjs +1 -1
- package/sum.min.cjs.map +1 -1
- package/sum.min.mjs +1 -1
- package/sum.min.mjs.map +1 -1
- package/sum.mjs +5 -18
- package/timeConstants.cjs +35 -69
- package/timeConstants.min.cjs +1 -1
- package/timeConstants.min.cjs.map +1 -1
- package/timeConstants.min.mjs +1 -1
- package/timeConstants.min.mjs.map +1 -1
- package/timeConstants.mjs +19 -15
- package/timer.cjs +7 -180
- package/timer.min.cjs +1 -1
- package/timer.min.cjs.map +1 -1
- package/timer.min.mjs +1 -1
- package/timer.min.mjs.map +1 -1
- package/timer.mjs +8 -154
- package/toReadableString.cjs +6 -68
- package/toReadableString.min.cjs +1 -5
- package/toReadableString.min.cjs.map +1 -1
- package/toReadableString.min.mjs +1 -5
- package/toReadableString.min.mjs.map +1 -1
- package/toReadableString.mjs +4 -41
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import {
|
|
2
|
+
elapsed,
|
|
3
|
+
init_duration
|
|
4
|
+
} from "./chunk-VG7VV7J2.mjs";
|
|
5
|
+
import {
|
|
6
|
+
__esm
|
|
7
|
+
} from "./chunk-M6PYQYOX.mjs";
|
|
8
|
+
|
|
9
|
+
// src/timer.ts
|
|
10
|
+
function timer() {
|
|
11
|
+
const obj = {
|
|
12
|
+
startMs: Date.now(),
|
|
13
|
+
endMs: 0,
|
|
14
|
+
stop() {
|
|
15
|
+
obj.endMs = Date.now();
|
|
16
|
+
},
|
|
17
|
+
restart() {
|
|
18
|
+
obj.endMs = 0;
|
|
19
|
+
obj.startMs = Date.now();
|
|
20
|
+
},
|
|
21
|
+
elapsedMs() {
|
|
22
|
+
const stopMs = obj.endMs || Date.now();
|
|
23
|
+
return stopMs - obj.startMs;
|
|
24
|
+
},
|
|
25
|
+
toString() {
|
|
26
|
+
return elapsed(obj.elapsedMs());
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
return obj;
|
|
30
|
+
}
|
|
31
|
+
var init_timer = __esm({
|
|
32
|
+
"src/timer.ts"() {
|
|
33
|
+
init_duration();
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
export {
|
|
38
|
+
timer,
|
|
39
|
+
init_timer
|
|
40
|
+
};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk27MBP3ESmincjs = require('./chunk-27MBP3ES.min.cjs');var _chunkQNNJNLGKmincjs = require('./chunk-QNNJNLGK.min.cjs');function a(){let t={startMs:Date.now(),endMs:0,stop(){t.endMs=Date.now()},restart(){t.endMs=0,t.startMs=Date.now()},elapsedMs(){return(t.endMs||Date.now())-t.startMs},toString(){return _chunk27MBP3ESmincjs.h.call(void 0, t.elapsedMs())}};return t}var n=_chunkQNNJNLGKmincjs.a.call(void 0, ()=>{_chunk27MBP3ESmincjs.i.call(void 0, )});exports.a = a; exports.b = n;
|
|
2
|
+
//# sourceMappingURL=chunk-ZKIZ5SWK.min.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/choksheaklau/src/ts-utils/dist/chunk-ZKIZ5SWK.min.cjs","../src/timer.ts"],"names":["timer","obj","elapsed","init_timer","__esmMin","init_duration"],"mappings":"AAAA,wIAAmD,+DAA6C,SCMhFA,CAAAA,CAAAA,CAAQ,CACtB,IAAMC,CAAAA,CAAM,CACV,OAAA,CAAS,IAAA,CAAK,GAAA,CAAI,CAAA,CAClB,KAAA,CAAO,CAAA,CAEP,IAAA,CAAA,CAAa,CACXA,CAAAA,CAAI,KAAA,CAAQ,IAAA,CAAK,GAAA,CAAI,CACvB,CAAA,CAEA,OAAA,CAAA,CAAgB,CACdA,CAAAA,CAAI,KAAA,CAAQ,CAAA,CACZA,CAAAA,CAAI,OAAA,CAAU,IAAA,CAAK,GAAA,CAAI,CACzB,CAAA,CAEA,SAAA,CAAA,CAAoB,CAElB,MAAA,CADeA,CAAAA,CAAI,KAAA,EAAS,IAAA,CAAK,GAAA,CAAI,CAAA,CAAA,CACrBA,CAAAA,CAAI,OACtB,CAAA,CAEA,QAAA,CAAA,CAAmB,CACjB,OAAOC,oCAAAA,CAAQD,CAAI,SAAA,CAAU,CAAC,CAChC,CACF,CAAA,CAEA,OAAOA,CACT,CA/BA,IAAAE,CAAAA,CAAAC,oCAAAA,CAAA,CAAA,EAAA,CAAAC,oCAAAA,CAAAA,CAAAA,CAAAA,CAAAA,6BAAAA","file":"/Users/choksheaklau/src/ts-utils/dist/chunk-ZKIZ5SWK.min.cjs","sourcesContent":[null,"import { elapsed } from \"./duration\";\n\n/**\n * Create a new timer and starts the timing right away. Returns a closed object\n * instead of a class to make sure the variables are bound correctly.\n */\nexport function timer() {\n const obj = {\n startMs: Date.now(),\n endMs: 0,\n\n stop(): void {\n obj.endMs = Date.now();\n },\n\n restart(): void {\n obj.endMs = 0;\n obj.startMs = Date.now();\n },\n\n elapsedMs(): number {\n const stopMs = obj.endMs || Date.now();\n return stopMs - obj.startMs;\n },\n\n toString(): string {\n return elapsed(obj.elapsedMs());\n },\n };\n\n return obj;\n}\n\n/** Defines the type of the Timer object. */\nexport type Timer = ReturnType<typeof timer>;\n"]}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__esm
|
|
3
|
+
} from "./chunk-M6PYQYOX.mjs";
|
|
4
|
+
|
|
5
|
+
// src/dateTimeStr.ts
|
|
6
|
+
function isAllDigits(str) {
|
|
7
|
+
return /^\d+$/.test(str);
|
|
8
|
+
}
|
|
9
|
+
function toDate(ts) {
|
|
10
|
+
if (typeof ts === "number") {
|
|
11
|
+
if (ts < 1e11) {
|
|
12
|
+
return new Date(ts * 1e3);
|
|
13
|
+
}
|
|
14
|
+
return new Date(ts);
|
|
15
|
+
}
|
|
16
|
+
if (typeof ts === "string") {
|
|
17
|
+
if (isAllDigits(ts)) {
|
|
18
|
+
return toDate(Number(ts));
|
|
19
|
+
}
|
|
20
|
+
return new Date(ts);
|
|
21
|
+
}
|
|
22
|
+
return ts;
|
|
23
|
+
}
|
|
24
|
+
function yyyyMm(dt = /* @__PURE__ */ new Date(), separator = "-") {
|
|
25
|
+
const yr = dt.getFullYear();
|
|
26
|
+
const mth = dt.getMonth() + 1;
|
|
27
|
+
return yr + separator + (mth < 10 ? "0" + mth : mth);
|
|
28
|
+
}
|
|
29
|
+
function yyyyMmDd(dt = /* @__PURE__ */ new Date(), separator = "-") {
|
|
30
|
+
const day = dt.getDate();
|
|
31
|
+
return yyyyMm(dt, separator) + separator + (day < 10 ? "0" + day : day);
|
|
32
|
+
}
|
|
33
|
+
function hhMm(dt = /* @__PURE__ */ new Date(), separator = ":") {
|
|
34
|
+
const hr = dt.getHours();
|
|
35
|
+
const min = dt.getMinutes();
|
|
36
|
+
return (hr < 10 ? "0" + hr : hr) + separator + (min < 10 ? "0" + min : min);
|
|
37
|
+
}
|
|
38
|
+
function hhMmSs(dt = /* @__PURE__ */ new Date(), separator = ":") {
|
|
39
|
+
const sec = dt.getSeconds();
|
|
40
|
+
return hhMm(dt, separator) + separator + (sec < 10 ? "0" + sec : sec);
|
|
41
|
+
}
|
|
42
|
+
function hhMmSsMs(dt = /* @__PURE__ */ new Date(), timeSeparator = ":", msSeparator = ".") {
|
|
43
|
+
const ms = dt.getMilliseconds();
|
|
44
|
+
return hhMmSs(dt, timeSeparator) + msSeparator + (ms < 10 ? "00" + ms : ms < 100 ? "0" + ms : ms);
|
|
45
|
+
}
|
|
46
|
+
function tzShort(dt = /* @__PURE__ */ new Date()) {
|
|
47
|
+
if (dt.getTimezoneOffset() === 0) {
|
|
48
|
+
return "Z";
|
|
49
|
+
}
|
|
50
|
+
const tzHours = dt.getTimezoneOffset() / 60;
|
|
51
|
+
return tzHours >= 0 ? "+" + tzHours : String(tzHours);
|
|
52
|
+
}
|
|
53
|
+
function getLongMonthNameZeroIndexed(month, locales = "default") {
|
|
54
|
+
return new Date(2024, month, 15).toLocaleString(locales, {
|
|
55
|
+
month: "long"
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
function getLongMonthNameOneIndexed(month, locales = "default") {
|
|
59
|
+
return getLongMonthNameZeroIndexed(month - 1, locales);
|
|
60
|
+
}
|
|
61
|
+
function getShortMonthNameZeroIndexed(month, locales = "default") {
|
|
62
|
+
return new Date(2e3, month, 15).toLocaleString(locales, {
|
|
63
|
+
month: "short"
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
function getShortMonthNameOneIndexed(month, locales = "default") {
|
|
67
|
+
return getShortMonthNameZeroIndexed(month - 1, locales);
|
|
68
|
+
}
|
|
69
|
+
function getDisplayDateTime(ts) {
|
|
70
|
+
const iso = toDate(ts).toISOString();
|
|
71
|
+
const noMs = iso.slice(0, 19) + "Z";
|
|
72
|
+
return noMs.replace("T", " ");
|
|
73
|
+
}
|
|
74
|
+
var init_dateTimeStr = __esm({
|
|
75
|
+
"src/dateTimeStr.ts"() {
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
export {
|
|
80
|
+
toDate,
|
|
81
|
+
yyyyMm,
|
|
82
|
+
yyyyMmDd,
|
|
83
|
+
hhMm,
|
|
84
|
+
hhMmSs,
|
|
85
|
+
hhMmSsMs,
|
|
86
|
+
tzShort,
|
|
87
|
+
getLongMonthNameZeroIndexed,
|
|
88
|
+
getLongMonthNameOneIndexed,
|
|
89
|
+
getShortMonthNameZeroIndexed,
|
|
90
|
+
getShortMonthNameOneIndexed,
|
|
91
|
+
getDisplayDateTime,
|
|
92
|
+
init_dateTimeStr
|
|
93
|
+
};
|
package/concatIterators.cjs
CHANGED
|
@@ -1,34 +1,11 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});require('./chunk-ILGTU46T.cjs');
|
|
19
2
|
|
|
20
3
|
// src/concatIterators.ts
|
|
21
|
-
var concatIterators_exports = {};
|
|
22
|
-
__export(concatIterators_exports, {
|
|
23
|
-
concatIterators: () => concatIterators
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(concatIterators_exports);
|
|
26
4
|
function* concatIterators(...iterators) {
|
|
27
5
|
for (const iterator of iterators) {
|
|
28
6
|
yield* iterator;
|
|
29
7
|
}
|
|
30
8
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
});
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
exports.concatIterators = concatIterators;
|
package/concatIterators.min.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});require('./chunk-QNNJNLGK.min.cjs');function*r(...o){for(let t of o)yield*t}exports.concatIterators = r;
|
|
2
2
|
//# sourceMappingURL=concatIterators.min.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/concatIterators.ts"],"sourcesContent":["/** Memory-efficient way to concat two or more iterators. */\nexport function* concatIterators<T>(...iterators: Generator<T>[]) {\n for (const iterator of iterators) {\n yield* iterator;\n }\n}\n"]
|
|
1
|
+
{"version":3,"sources":["/Users/choksheaklau/src/ts-utils/dist/concatIterators.min.cjs","../src/concatIterators.ts"],"names":["concatIterators","iterators","iterator"],"mappings":"AAAA,6GAAgC,QCCzB,CAAUA,CAAAA,CAAAA,GAAsBC,CAAAA,CAA2B,CAChE,GAAA,CAAA,IAAWC,EAAAA,GAAYD,CAAAA,CACrB,KAAA,CAAOC,CAEX,CAAA,4BAAA","file":"/Users/choksheaklau/src/ts-utils/dist/concatIterators.min.cjs","sourcesContent":[null,"/** Memory-efficient way to concat two or more iterators. */\nexport function* concatIterators<T>(...iterators: Generator<T>[]) {\n for (const iterator of iterators) {\n yield* iterator;\n }\n}\n"]}
|
package/concatIterators.min.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function*r(...o){for(let t of o)yield*t}export{r as concatIterators};
|
|
1
|
+
import"./chunk-UOU6IP3S.min.mjs";function*r(...o){for(let t of o)yield*t}export{r as concatIterators};
|
|
2
2
|
//# sourceMappingURL=concatIterators.min.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/concatIterators.ts"],"sourcesContent":["/** Memory-efficient way to concat two or more iterators. */\nexport function* concatIterators<T>(...iterators: Generator<T>[]) {\n for (const iterator of iterators) {\n yield* iterator;\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/concatIterators.ts"],"sourcesContent":["/** Memory-efficient way to concat two or more iterators. */\nexport function* concatIterators<T>(...iterators: Generator<T>[]) {\n for (const iterator of iterators) {\n yield* iterator;\n }\n}\n"],"mappings":"iCACO,SAAUA,KAAsBC,EAA2B,CAChE,QAAWC,KAAYD,EACrB,MAAOC,CAEX","names":["concatIterators","iterators","iterator"]}
|
package/concatIterators.mjs
CHANGED
package/dateTimeStr.cjs
CHANGED
|
@@ -1,119 +1,31 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
tzShort: () => tzShort,
|
|
33
|
-
yyyyMm: () => yyyyMm,
|
|
34
|
-
yyyyMmDd: () => yyyyMmDd
|
|
35
|
-
});
|
|
36
|
-
module.exports = __toCommonJS(dateTimeStr_exports);
|
|
37
|
-
function isAllDigits(str) {
|
|
38
|
-
return /^\d+$/.test(str);
|
|
39
|
-
}
|
|
40
|
-
function toDate(ts) {
|
|
41
|
-
if (typeof ts === "number") {
|
|
42
|
-
if (ts < 1e11) {
|
|
43
|
-
return new Date(ts * 1e3);
|
|
44
|
-
}
|
|
45
|
-
return new Date(ts);
|
|
46
|
-
}
|
|
47
|
-
if (typeof ts === "string") {
|
|
48
|
-
if (isAllDigits(ts)) {
|
|
49
|
-
return toDate(Number(ts));
|
|
50
|
-
}
|
|
51
|
-
return new Date(ts);
|
|
52
|
-
}
|
|
53
|
-
return ts;
|
|
54
|
-
}
|
|
55
|
-
function yyyyMm(dt = /* @__PURE__ */ new Date(), separator = "-") {
|
|
56
|
-
const yr = dt.getFullYear();
|
|
57
|
-
const mth = dt.getMonth() + 1;
|
|
58
|
-
return yr + separator + (mth < 10 ? "0" + mth : mth);
|
|
59
|
-
}
|
|
60
|
-
function yyyyMmDd(dt = /* @__PURE__ */ new Date(), separator = "-") {
|
|
61
|
-
const day = dt.getDate();
|
|
62
|
-
return yyyyMm(dt, separator) + separator + (day < 10 ? "0" + day : day);
|
|
63
|
-
}
|
|
64
|
-
function hhMm(dt = /* @__PURE__ */ new Date(), separator = ":") {
|
|
65
|
-
const hr = dt.getHours();
|
|
66
|
-
const min = dt.getMinutes();
|
|
67
|
-
return (hr < 10 ? "0" + hr : hr) + separator + (min < 10 ? "0" + min : min);
|
|
68
|
-
}
|
|
69
|
-
function hhMmSs(dt = /* @__PURE__ */ new Date(), separator = ":") {
|
|
70
|
-
const sec = dt.getSeconds();
|
|
71
|
-
return hhMm(dt, separator) + separator + (sec < 10 ? "0" + sec : sec);
|
|
72
|
-
}
|
|
73
|
-
function hhMmSsMs(dt = /* @__PURE__ */ new Date(), timeSeparator = ":", msSeparator = ".") {
|
|
74
|
-
const ms = dt.getMilliseconds();
|
|
75
|
-
return hhMmSs(dt, timeSeparator) + msSeparator + (ms < 10 ? "00" + ms : ms < 100 ? "0" + ms : ms);
|
|
76
|
-
}
|
|
77
|
-
function tzShort(dt = /* @__PURE__ */ new Date()) {
|
|
78
|
-
if (dt.getTimezoneOffset() === 0) {
|
|
79
|
-
return "Z";
|
|
80
|
-
}
|
|
81
|
-
const tzHours = dt.getTimezoneOffset() / 60;
|
|
82
|
-
return tzHours >= 0 ? "+" + tzHours : String(tzHours);
|
|
83
|
-
}
|
|
84
|
-
function getLongMonthNameZeroIndexed(month, locales = "default") {
|
|
85
|
-
return new Date(2024, month, 15).toLocaleString(locales, {
|
|
86
|
-
month: "long"
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
function getLongMonthNameOneIndexed(month, locales = "default") {
|
|
90
|
-
return getLongMonthNameZeroIndexed(month - 1, locales);
|
|
91
|
-
}
|
|
92
|
-
function getShortMonthNameZeroIndexed(month, locales = "default") {
|
|
93
|
-
return new Date(2e3, month, 15).toLocaleString(locales, {
|
|
94
|
-
month: "short"
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
function getShortMonthNameOneIndexed(month, locales = "default") {
|
|
98
|
-
return getShortMonthNameZeroIndexed(month - 1, locales);
|
|
99
|
-
}
|
|
100
|
-
function getDisplayDateTime(ts) {
|
|
101
|
-
const iso = toDate(ts).toISOString();
|
|
102
|
-
const noMs = iso.slice(0, 19) + "Z";
|
|
103
|
-
return noMs.replace("T", " ");
|
|
104
|
-
}
|
|
105
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
106
|
-
0 && (module.exports = {
|
|
107
|
-
getDisplayDateTime,
|
|
108
|
-
getLongMonthNameOneIndexed,
|
|
109
|
-
getLongMonthNameZeroIndexed,
|
|
110
|
-
getShortMonthNameOneIndexed,
|
|
111
|
-
getShortMonthNameZeroIndexed,
|
|
112
|
-
hhMm,
|
|
113
|
-
hhMmSs,
|
|
114
|
-
hhMmSsMs,
|
|
115
|
-
toDate,
|
|
116
|
-
tzShort,
|
|
117
|
-
yyyyMm,
|
|
118
|
-
yyyyMmDd
|
|
119
|
-
});
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
var _chunkCERFUU5Icjs = require('./chunk-CERFUU5I.cjs');
|
|
16
|
+
require('./chunk-ILGTU46T.cjs');
|
|
17
|
+
_chunkCERFUU5Icjs.init_dateTimeStr.call(void 0, );
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
exports.getDisplayDateTime = _chunkCERFUU5Icjs.getDisplayDateTime; exports.getLongMonthNameOneIndexed = _chunkCERFUU5Icjs.getLongMonthNameOneIndexed; exports.getLongMonthNameZeroIndexed = _chunkCERFUU5Icjs.getLongMonthNameZeroIndexed; exports.getShortMonthNameOneIndexed = _chunkCERFUU5Icjs.getShortMonthNameOneIndexed; exports.getShortMonthNameZeroIndexed = _chunkCERFUU5Icjs.getShortMonthNameZeroIndexed; exports.hhMm = _chunkCERFUU5Icjs.hhMm; exports.hhMmSs = _chunkCERFUU5Icjs.hhMmSs; exports.hhMmSsMs = _chunkCERFUU5Icjs.hhMmSsMs; exports.toDate = _chunkCERFUU5Icjs.toDate; exports.tzShort = _chunkCERFUU5Icjs.tzShort; exports.yyyyMm = _chunkCERFUU5Icjs.yyyyMm; exports.yyyyMmDd = _chunkCERFUU5Icjs.yyyyMmDd;
|
package/dateTimeStr.min.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkSJDJDNDNmincjs = require('./chunk-SJDJDNDN.min.cjs');require('./chunk-QNNJNLGK.min.cjs');_chunkSJDJDNDNmincjs.m.call(void 0, );exports.getDisplayDateTime = _chunkSJDJDNDNmincjs.l; exports.getLongMonthNameOneIndexed = _chunkSJDJDNDNmincjs.i; exports.getLongMonthNameZeroIndexed = _chunkSJDJDNDNmincjs.h; exports.getShortMonthNameOneIndexed = _chunkSJDJDNDNmincjs.k; exports.getShortMonthNameZeroIndexed = _chunkSJDJDNDNmincjs.j; exports.hhMm = _chunkSJDJDNDNmincjs.d; exports.hhMmSs = _chunkSJDJDNDNmincjs.e; exports.hhMmSsMs = _chunkSJDJDNDNmincjs.f; exports.toDate = _chunkSJDJDNDNmincjs.a; exports.tzShort = _chunkSJDJDNDNmincjs.g; exports.yyyyMm = _chunkSJDJDNDNmincjs.b; exports.yyyyMmDd = _chunkSJDJDNDNmincjs.c;
|
|
2
2
|
//# sourceMappingURL=dateTimeStr.min.cjs.map
|
package/dateTimeStr.min.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["/Users/choksheaklau/src/ts-utils/dist/dateTimeStr.min.cjs"],"names":[],"mappings":"AAAA,wIAA+D,oCAAiC,oCAAE,CAAE,CAAC,8kBAA0P","file":"/Users/choksheaklau/src/ts-utils/dist/dateTimeStr.min.cjs"}
|
package/dateTimeStr.min.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import{a,b,c,d,e,f,g,h,i,j,k,l,m}from"./chunk-SV35RBZ7.min.mjs";import"./chunk-UOU6IP3S.min.mjs";m();export{l as getDisplayDateTime,i as getLongMonthNameOneIndexed,h as getLongMonthNameZeroIndexed,k as getShortMonthNameOneIndexed,j as getShortMonthNameZeroIndexed,d as hhMm,e as hhMmSs,f as hhMmSsMs,a as toDate,g as tzShort,b as yyyyMm,c as yyyyMmDd};
|
|
2
2
|
//# sourceMappingURL=dateTimeStr.min.mjs.map
|
package/dateTimeStr.min.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dateTimeStr.mjs
CHANGED
|
@@ -1,72 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return ts;
|
|
19
|
-
}
|
|
20
|
-
function yyyyMm(dt = /* @__PURE__ */ new Date(), separator = "-") {
|
|
21
|
-
const yr = dt.getFullYear();
|
|
22
|
-
const mth = dt.getMonth() + 1;
|
|
23
|
-
return yr + separator + (mth < 10 ? "0" + mth : mth);
|
|
24
|
-
}
|
|
25
|
-
function yyyyMmDd(dt = /* @__PURE__ */ new Date(), separator = "-") {
|
|
26
|
-
const day = dt.getDate();
|
|
27
|
-
return yyyyMm(dt, separator) + separator + (day < 10 ? "0" + day : day);
|
|
28
|
-
}
|
|
29
|
-
function hhMm(dt = /* @__PURE__ */ new Date(), separator = ":") {
|
|
30
|
-
const hr = dt.getHours();
|
|
31
|
-
const min = dt.getMinutes();
|
|
32
|
-
return (hr < 10 ? "0" + hr : hr) + separator + (min < 10 ? "0" + min : min);
|
|
33
|
-
}
|
|
34
|
-
function hhMmSs(dt = /* @__PURE__ */ new Date(), separator = ":") {
|
|
35
|
-
const sec = dt.getSeconds();
|
|
36
|
-
return hhMm(dt, separator) + separator + (sec < 10 ? "0" + sec : sec);
|
|
37
|
-
}
|
|
38
|
-
function hhMmSsMs(dt = /* @__PURE__ */ new Date(), timeSeparator = ":", msSeparator = ".") {
|
|
39
|
-
const ms = dt.getMilliseconds();
|
|
40
|
-
return hhMmSs(dt, timeSeparator) + msSeparator + (ms < 10 ? "00" + ms : ms < 100 ? "0" + ms : ms);
|
|
41
|
-
}
|
|
42
|
-
function tzShort(dt = /* @__PURE__ */ new Date()) {
|
|
43
|
-
if (dt.getTimezoneOffset() === 0) {
|
|
44
|
-
return "Z";
|
|
45
|
-
}
|
|
46
|
-
const tzHours = dt.getTimezoneOffset() / 60;
|
|
47
|
-
return tzHours >= 0 ? "+" + tzHours : String(tzHours);
|
|
48
|
-
}
|
|
49
|
-
function getLongMonthNameZeroIndexed(month, locales = "default") {
|
|
50
|
-
return new Date(2024, month, 15).toLocaleString(locales, {
|
|
51
|
-
month: "long"
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
function getLongMonthNameOneIndexed(month, locales = "default") {
|
|
55
|
-
return getLongMonthNameZeroIndexed(month - 1, locales);
|
|
56
|
-
}
|
|
57
|
-
function getShortMonthNameZeroIndexed(month, locales = "default") {
|
|
58
|
-
return new Date(2e3, month, 15).toLocaleString(locales, {
|
|
59
|
-
month: "short"
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
function getShortMonthNameOneIndexed(month, locales = "default") {
|
|
63
|
-
return getShortMonthNameZeroIndexed(month - 1, locales);
|
|
64
|
-
}
|
|
65
|
-
function getDisplayDateTime(ts) {
|
|
66
|
-
const iso = toDate(ts).toISOString();
|
|
67
|
-
const noMs = iso.slice(0, 19) + "Z";
|
|
68
|
-
return noMs.replace("T", " ");
|
|
69
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
getDisplayDateTime,
|
|
3
|
+
getLongMonthNameOneIndexed,
|
|
4
|
+
getLongMonthNameZeroIndexed,
|
|
5
|
+
getShortMonthNameOneIndexed,
|
|
6
|
+
getShortMonthNameZeroIndexed,
|
|
7
|
+
hhMm,
|
|
8
|
+
hhMmSs,
|
|
9
|
+
hhMmSsMs,
|
|
10
|
+
init_dateTimeStr,
|
|
11
|
+
toDate,
|
|
12
|
+
tzShort,
|
|
13
|
+
yyyyMm,
|
|
14
|
+
yyyyMmDd
|
|
15
|
+
} from "./chunk-ZZZB7NJX.mjs";
|
|
16
|
+
import "./chunk-M6PYQYOX.mjs";
|
|
17
|
+
init_dateTimeStr();
|
|
70
18
|
export {
|
|
71
19
|
getDisplayDateTime,
|
|
72
20
|
getLongMonthNameOneIndexed,
|