@choksheak/ts-utils 0.3.6 → 0.3.7

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.
Files changed (256) hide show
  1. package/arrayBuffer.cjs +39 -10
  2. package/arrayBuffer.min.cjs +1 -1
  3. package/arrayBuffer.min.cjs.map +1 -1
  4. package/arrayBuffer.min.mjs +1 -1
  5. package/arrayBuffer.min.mjs.map +1 -1
  6. package/arrayBuffer.mjs +10 -7
  7. package/asNumber.cjs +38 -6
  8. package/asNumber.min.cjs +1 -1
  9. package/asNumber.min.cjs.map +1 -1
  10. package/asNumber.min.mjs +1 -1
  11. package/asNumber.min.mjs.map +1 -1
  12. package/asNumber.mjs +11 -4
  13. package/assert.cjs +27 -4
  14. package/assert.min.cjs +1 -1
  15. package/assert.min.cjs.map +1 -1
  16. package/assert.min.mjs +1 -1
  17. package/assert.min.mjs.map +1 -1
  18. package/assert.mjs +0 -2
  19. package/base64Url.cjs +29 -5
  20. package/base64Url.min.cjs +1 -1
  21. package/base64Url.min.cjs.map +1 -1
  22. package/base64Url.min.mjs +1 -1
  23. package/base64Url.min.mjs.map +1 -1
  24. package/base64Url.mjs +0 -2
  25. package/capLength.cjs +71 -7
  26. package/capLength.min.cjs +5 -1
  27. package/capLength.min.cjs.map +1 -1
  28. package/capLength.min.mjs +5 -1
  29. package/capLength.min.mjs.map +1 -1
  30. package/capLength.mjs +41 -4
  31. package/concatIterators.cjs +27 -4
  32. package/concatIterators.min.cjs +1 -1
  33. package/concatIterators.min.cjs.map +1 -1
  34. package/concatIterators.min.mjs +1 -1
  35. package/concatIterators.min.mjs.map +1 -1
  36. package/concatIterators.mjs +0 -2
  37. package/dateTimeStr.cjs +119 -31
  38. package/dateTimeStr.min.cjs +1 -1
  39. package/dateTimeStr.min.cjs.map +1 -1
  40. package/dateTimeStr.min.mjs +1 -1
  41. package/dateTimeStr.min.mjs.map +1 -1
  42. package/dateTimeStr.mjs +69 -17
  43. package/duration.cjs +188 -24
  44. package/duration.min.cjs +1 -1
  45. package/duration.min.cjs.map +1 -1
  46. package/duration.min.mjs +1 -1
  47. package/duration.min.mjs.map +1 -1
  48. package/duration.mjs +144 -14
  49. package/getEnv.cjs +31 -7
  50. package/getEnv.min.cjs +1 -1
  51. package/getEnv.min.cjs.map +1 -1
  52. package/getEnv.min.mjs +1 -1
  53. package/getEnv.min.mjs.map +1 -1
  54. package/getEnv.mjs +0 -2
  55. package/isEmpty.cjs +46 -8
  56. package/isEmpty.min.cjs +1 -1
  57. package/isEmpty.min.cjs.map +1 -1
  58. package/isEmpty.min.mjs +1 -1
  59. package/isEmpty.min.mjs.map +1 -1
  60. package/isEmpty.mjs +19 -6
  61. package/isPromise.cjs +29 -5
  62. package/isPromise.min.cjs +1 -1
  63. package/isPromise.min.cjs.map +1 -1
  64. package/isPromise.min.mjs +1 -1
  65. package/isPromise.min.mjs.map +1 -1
  66. package/isPromise.mjs +0 -2
  67. package/kvStore.cjs +353 -15
  68. package/kvStore.min.cjs +1 -1
  69. package/kvStore.min.cjs.map +1 -1
  70. package/kvStore.min.mjs +1 -1
  71. package/kvStore.min.mjs.map +1 -1
  72. package/kvStore.mjs +319 -12
  73. package/localStore.cjs +264 -15
  74. package/localStore.min.cjs +1 -1
  75. package/localStore.min.cjs.map +1 -1
  76. package/localStore.min.mjs +1 -1
  77. package/localStore.min.mjs.map +1 -1
  78. package/localStore.mjs +230 -12
  79. package/mean.cjs +48 -8
  80. package/mean.min.cjs +1 -1
  81. package/mean.min.cjs.map +1 -1
  82. package/mean.min.mjs +1 -1
  83. package/mean.min.mjs.map +1 -1
  84. package/mean.mjs +18 -5
  85. package/median.cjs +41 -7
  86. package/median.min.cjs +1 -1
  87. package/median.min.cjs.map +1 -1
  88. package/median.min.mjs +1 -1
  89. package/median.min.mjs.map +1 -1
  90. package/median.mjs +11 -4
  91. package/nonEmpty.cjs +48 -8
  92. package/nonEmpty.min.cjs +1 -1
  93. package/nonEmpty.min.cjs.map +1 -1
  94. package/nonEmpty.min.mjs +1 -1
  95. package/nonEmpty.min.mjs.map +1 -1
  96. package/nonEmpty.mjs +19 -6
  97. package/nonNil.cjs +27 -4
  98. package/nonNil.min.cjs +1 -1
  99. package/nonNil.min.cjs.map +1 -1
  100. package/nonNil.min.mjs +1 -1
  101. package/nonNil.min.mjs.map +1 -1
  102. package/nonNil.mjs +0 -2
  103. package/package.json +1 -257
  104. package/round.cjs +32 -6
  105. package/round.min.cjs +1 -1
  106. package/round.min.cjs.map +1 -1
  107. package/round.min.mjs +1 -1
  108. package/round.min.mjs.map +1 -1
  109. package/round.mjs +5 -4
  110. package/roundToString.cjs +35 -7
  111. package/roundToString.min.cjs +1 -1
  112. package/roundToString.min.cjs.map +1 -1
  113. package/roundToString.min.mjs +1 -1
  114. package/roundToString.min.mjs.map +1 -1
  115. package/roundToString.mjs +5 -4
  116. package/safeBtoa.cjs +27 -4
  117. package/safeBtoa.min.cjs +1 -1
  118. package/safeBtoa.min.cjs.map +1 -1
  119. package/safeBtoa.min.mjs +1 -1
  120. package/safeBtoa.min.mjs.map +1 -1
  121. package/safeBtoa.mjs +0 -2
  122. package/sha256.cjs +34 -8
  123. package/sha256.min.cjs +1 -1
  124. package/sha256.min.cjs.map +1 -1
  125. package/sha256.min.mjs +1 -1
  126. package/sha256.min.mjs.map +1 -1
  127. package/sha256.mjs +7 -6
  128. package/sleep.cjs +27 -4
  129. package/sleep.min.cjs +1 -1
  130. package/sleep.min.cjs.map +1 -1
  131. package/sleep.min.mjs +1 -1
  132. package/sleep.min.mjs.map +1 -1
  133. package/sleep.mjs +0 -2
  134. package/storageAdapter.cjs +18 -1
  135. package/storageAdapter.min.cjs +2 -1
  136. package/storageAdapter.min.cjs.map +1 -1
  137. package/sum.cjs +45 -5
  138. package/sum.min.cjs +1 -1
  139. package/sum.min.cjs.map +1 -1
  140. package/sum.min.mjs +1 -1
  141. package/sum.min.mjs.map +1 -1
  142. package/sum.mjs +18 -5
  143. package/timeConstants.cjs +69 -35
  144. package/timeConstants.min.cjs +1 -1
  145. package/timeConstants.min.cjs.map +1 -1
  146. package/timeConstants.min.mjs +1 -1
  147. package/timeConstants.min.mjs.map +1 -1
  148. package/timeConstants.mjs +15 -19
  149. package/timer.cjs +180 -7
  150. package/timer.min.cjs +1 -1
  151. package/timer.min.cjs.map +1 -1
  152. package/timer.min.mjs +1 -1
  153. package/timer.min.mjs.map +1 -1
  154. package/timer.mjs +154 -8
  155. package/toReadableString.cjs +68 -6
  156. package/toReadableString.min.cjs +5 -1
  157. package/toReadableString.min.cjs.map +1 -1
  158. package/toReadableString.min.mjs +5 -1
  159. package/toReadableString.min.mjs.map +1 -1
  160. package/toReadableString.mjs +41 -4
  161. package/chunk-22JDWCOS.min.cjs +0 -2
  162. package/chunk-22JDWCOS.min.cjs.map +0 -1
  163. package/chunk-244NBT4Q.min.mjs +0 -2
  164. package/chunk-244NBT4Q.min.mjs.map +0 -1
  165. package/chunk-27MBP3ES.min.cjs +0 -2
  166. package/chunk-27MBP3ES.min.cjs.map +0 -1
  167. package/chunk-34ENP2B3.min.mjs +0 -438
  168. package/chunk-34ENP2B3.min.mjs.map +0 -1
  169. package/chunk-3EBQ2GO2.min.cjs +0 -2
  170. package/chunk-3EBQ2GO2.min.cjs.map +0 -1
  171. package/chunk-4GLOLTJ5.cjs +0 -167
  172. package/chunk-6TQBMXTL.min.cjs +0 -2
  173. package/chunk-6TQBMXTL.min.cjs.map +0 -1
  174. package/chunk-AWZBCFMG.min.cjs +0 -2
  175. package/chunk-AWZBCFMG.min.cjs.map +0 -1
  176. package/chunk-AXNETZET.cjs +0 -20
  177. package/chunk-BKZM6NWX.min.cjs +0 -2
  178. package/chunk-BKZM6NWX.min.cjs.map +0 -1
  179. package/chunk-BZKQXX3A.cjs +0 -40
  180. package/chunk-CERFUU5I.cjs +0 -93
  181. package/chunk-CSTKFJ6G.mjs +0 -239
  182. package/chunk-DUN4UY2Q.cjs +0 -239
  183. package/chunk-EDJJUP4K.min.cjs +0 -6
  184. package/chunk-EDJJUP4K.min.cjs.map +0 -1
  185. package/chunk-FFNQBZH5.cjs +0 -14
  186. package/chunk-FZZRSHSH.min.mjs +0 -6
  187. package/chunk-FZZRSHSH.min.mjs.map +0 -1
  188. package/chunk-GAP2HS5M.min.cjs +0 -2
  189. package/chunk-GAP2HS5M.min.cjs.map +0 -1
  190. package/chunk-GLYMAPS4.min.mjs +0 -2
  191. package/chunk-GLYMAPS4.min.mjs.map +0 -1
  192. package/chunk-I65KPVMO.min.cjs +0 -438
  193. package/chunk-I65KPVMO.min.cjs.map +0 -1
  194. package/chunk-ILGTU46T.cjs +0 -39
  195. package/chunk-IOKRXHKE.min.mjs +0 -2
  196. package/chunk-IOKRXHKE.min.mjs.map +0 -1
  197. package/chunk-ISP4SMRC.min.cjs +0 -2
  198. package/chunk-ISP4SMRC.min.cjs.map +0 -1
  199. package/chunk-KETP5HBF.cjs +0 -24
  200. package/chunk-KLHNGJ4Y.min.mjs +0 -2
  201. package/chunk-KLHNGJ4Y.min.mjs.map +0 -1
  202. package/chunk-KMNTU3DJ.mjs +0 -45
  203. package/chunk-LDVEXETI.cjs +0 -45
  204. package/chunk-LZENHV35.min.cjs +0 -2
  205. package/chunk-LZENHV35.min.cjs.map +0 -1
  206. package/chunk-M5PIM2HB.mjs +0 -42
  207. package/chunk-M6PYQYOX.mjs +0 -39
  208. package/chunk-MN5EYNZN.min.mjs +0 -2
  209. package/chunk-MN5EYNZN.min.mjs.map +0 -1
  210. package/chunk-NRIBJ2OJ.mjs +0 -16031
  211. package/chunk-NVLYXWLX.cjs +0 -32
  212. package/chunk-O352F2MT.mjs +0 -24
  213. package/chunk-O6B2TKFK.min.mjs +0 -2
  214. package/chunk-O6B2TKFK.min.mjs.map +0 -1
  215. package/chunk-OGF34H4T.min.cjs +0 -2
  216. package/chunk-OGF34H4T.min.cjs.map +0 -1
  217. package/chunk-OXSWWWOM.min.mjs +0 -2
  218. package/chunk-OXSWWWOM.min.mjs.map +0 -1
  219. package/chunk-PRUGHVRT.mjs +0 -14
  220. package/chunk-Q4WCMSOW.min.mjs +0 -2
  221. package/chunk-Q4WCMSOW.min.mjs.map +0 -1
  222. package/chunk-QH74JZCK.mjs +0 -9
  223. package/chunk-QNNJNLGK.min.cjs +0 -2
  224. package/chunk-QNNJNLGK.min.cjs.map +0 -1
  225. package/chunk-QWCFN7ZM.mjs +0 -15
  226. package/chunk-SDM2OPT6.mjs +0 -32
  227. package/chunk-SHKRZCF2.cjs +0 -16031
  228. package/chunk-SJDJDNDN.min.cjs +0 -2
  229. package/chunk-SJDJDNDN.min.cjs.map +0 -1
  230. package/chunk-SULNMALN.cjs +0 -328
  231. package/chunk-SV35RBZ7.min.mjs +0 -2
  232. package/chunk-SV35RBZ7.min.mjs.map +0 -1
  233. package/chunk-TJFYGFOW.mjs +0 -328
  234. package/chunk-UHRYBUUX.min.mjs +0 -2
  235. package/chunk-UHRYBUUX.min.mjs.map +0 -1
  236. package/chunk-UOU6IP3S.min.mjs +0 -2
  237. package/chunk-UOU6IP3S.min.mjs.map +0 -1
  238. package/chunk-V76XVNZ5.mjs +0 -20
  239. package/chunk-VFYQ7I5V.min.mjs +0 -2
  240. package/chunk-VFYQ7I5V.min.mjs.map +0 -1
  241. package/chunk-VG7VV7J2.mjs +0 -167
  242. package/chunk-VJCV56DO.cjs +0 -15
  243. package/chunk-VREA6AKG.cjs +0 -9
  244. package/chunk-W5I6Y5FK.min.mjs +0 -2
  245. package/chunk-W5I6Y5FK.min.mjs.map +0 -1
  246. package/chunk-Y7MC73BZ.cjs +0 -42
  247. package/chunk-YVWROQKU.mjs +0 -40
  248. package/chunk-ZKIZ5SWK.min.cjs +0 -2
  249. package/chunk-ZKIZ5SWK.min.cjs.map +0 -1
  250. package/chunk-ZZZB7NJX.mjs +0 -93
  251. package/magic-string.es-4UY437WL.min.mjs +0 -14
  252. package/magic-string.es-4UY437WL.min.mjs.map +0 -1
  253. package/magic-string.es-OAQWZQTY.mjs +0 -1323
  254. package/magic-string.es-UE2UVQEL.cjs +0 -1323
  255. package/magic-string.es-X6DNUB6Y.min.cjs +0 -14
  256. package/magic-string.es-X6DNUB6Y.min.cjs.map +0 -1
package/duration.mjs CHANGED
@@ -1,17 +1,147 @@
1
- import {
2
- DURATION_STYLE_SUFFIX_MAP,
3
- DURATION_TYPE_SEQUENCE,
4
- durationOrMsToMs,
5
- durationToMs,
6
- elapsed,
7
- formatDuration,
8
- init_duration,
9
- msToDuration,
10
- readableDuration
11
- } from "./chunk-VG7VV7J2.mjs";
12
- import "./chunk-M5PIM2HB.mjs";
13
- import "./chunk-M6PYQYOX.mjs";
14
- init_duration();
1
+ // src/timeConstants.ts
2
+ var MS_PER_SECOND = 1e3;
3
+ var MS_PER_MINUTE = 6e4;
4
+ var MS_PER_HOUR = 36e5;
5
+ var MS_PER_DAY = 864e5;
6
+ var SECONDS_PER_MINUTE = 60;
7
+ var MINUTES_PER_HOUR = 60;
8
+ var HOURS_PER_DAY = 24;
9
+
10
+ // src/duration.ts
11
+ var DURATION_TYPE_SEQUENCE = [
12
+ "days",
13
+ "hours",
14
+ "minutes",
15
+ "seconds",
16
+ "milliseconds"
17
+ ];
18
+ var DURATION_STYLE_SUFFIX_MAP = {
19
+ days: {
20
+ short: "day",
21
+ shorts: "days",
22
+ long: "day",
23
+ longs: "days",
24
+ narrow: "d"
25
+ },
26
+ hours: {
27
+ short: "hr",
28
+ shorts: "hrs",
29
+ long: "hour",
30
+ longs: "hours",
31
+ narrow: "h"
32
+ },
33
+ minutes: {
34
+ short: "min",
35
+ shorts: "mins",
36
+ long: "minute",
37
+ longs: "minutes",
38
+ narrow: "m"
39
+ },
40
+ seconds: {
41
+ short: "sec",
42
+ shorts: "secs",
43
+ long: "second",
44
+ longs: "seconds",
45
+ narrow: "s"
46
+ },
47
+ milliseconds: {
48
+ short: "ms",
49
+ shorts: "ms",
50
+ long: "millisecond",
51
+ longs: "milliseconds",
52
+ narrow: "ms"
53
+ }
54
+ };
55
+ function getDurationStyleForPlural(style) {
56
+ return style == "short" ? "shorts" : style === "long" ? "longs" : style;
57
+ }
58
+ function getValueAndUnitSeparator(style) {
59
+ return style === "narrow" ? "" : " ";
60
+ }
61
+ function getDurationTypeSeparator(style) {
62
+ return style === "narrow" ? " " : ", ";
63
+ }
64
+ function msToDuration(ms, durationTypeForZero) {
65
+ if (ms === 0) {
66
+ durationTypeForZero = durationTypeForZero ?? "milliseconds";
67
+ return { [durationTypeForZero]: 0 };
68
+ }
69
+ const duration = {};
70
+ for (let i = 0; i < 1; i++) {
71
+ let seconds = Math.floor(ms / MS_PER_SECOND);
72
+ const millis = ms - seconds * MS_PER_SECOND;
73
+ if (millis > 0) {
74
+ duration["milliseconds"] = millis;
75
+ }
76
+ if (seconds === 0) {
77
+ break;
78
+ }
79
+ let minutes = Math.floor(seconds / SECONDS_PER_MINUTE);
80
+ seconds -= minutes * SECONDS_PER_MINUTE;
81
+ if (seconds > 0) {
82
+ duration["seconds"] = seconds;
83
+ }
84
+ if (minutes === 0) {
85
+ break;
86
+ }
87
+ let hours = Math.floor(minutes / MINUTES_PER_HOUR);
88
+ minutes -= hours * MINUTES_PER_HOUR;
89
+ if (minutes > 0) {
90
+ duration["minutes"] = minutes;
91
+ }
92
+ if (hours === 0) {
93
+ break;
94
+ }
95
+ const days = Math.floor(hours / HOURS_PER_DAY);
96
+ hours -= days * HOURS_PER_DAY;
97
+ if (hours > 0) {
98
+ duration["hours"] = hours;
99
+ }
100
+ if (days > 0) {
101
+ duration["days"] = days;
102
+ }
103
+ }
104
+ return duration;
105
+ }
106
+ function durationToMs(duration) {
107
+ const daysMs = (duration.days ?? 0) * MS_PER_DAY;
108
+ const hoursMs = (duration.hours ?? 0) * MS_PER_HOUR;
109
+ const minsMs = (duration.minutes ?? 0) * MS_PER_MINUTE;
110
+ const secsMs = (duration.seconds ?? 0) * MS_PER_SECOND;
111
+ const msMs = duration.milliseconds ?? 0;
112
+ return daysMs + hoursMs + minsMs + secsMs + msMs;
113
+ }
114
+ function durationOrMsToMs(duration) {
115
+ return typeof duration === "number" ? duration : durationToMs(duration);
116
+ }
117
+ function formatDuration(duration, style) {
118
+ style = style ?? "short";
119
+ const stylePlural = getDurationStyleForPlural(style);
120
+ const space = getValueAndUnitSeparator(style);
121
+ const a = [];
122
+ for (const unit of DURATION_TYPE_SEQUENCE) {
123
+ const value = duration[unit];
124
+ if (value === void 0) continue;
125
+ const suffixMap = DURATION_STYLE_SUFFIX_MAP[unit];
126
+ const suffix = value === 1 ? suffixMap[style] : suffixMap[stylePlural];
127
+ a.push(value + space + suffix);
128
+ }
129
+ const separator = getDurationTypeSeparator(style);
130
+ return a.join(separator);
131
+ }
132
+ function readableDuration(ms, options) {
133
+ const duration = msToDuration(ms, options?.durationTypeForZero);
134
+ return formatDuration(duration, options?.style);
135
+ }
136
+ function elapsed(ms) {
137
+ if (ms > MS_PER_MINUTE) {
138
+ return readableDuration(ms);
139
+ }
140
+ if (ms > 100) {
141
+ return `${(ms / 1e3).toFixed(3)}s`;
142
+ }
143
+ return ms + "ms";
144
+ }
15
145
  export {
16
146
  DURATION_STYLE_SUFFIX_MAP,
17
147
  DURATION_TYPE_SEQUENCE,
package/getEnv.cjs CHANGED
@@ -1,20 +1,44 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }require('./chunk-ILGTU46T.cjs');
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);
2
19
 
3
20
  // src/getEnv.ts
21
+ var getEnv_exports = {};
22
+ __export(getEnv_exports, {
23
+ MissingEnvVarError: () => MissingEnvVarError,
24
+ getEnv: () => getEnv
25
+ });
26
+ module.exports = __toCommonJS(getEnv_exports);
4
27
  var MissingEnvVarError = class extends Error {
5
28
  };
6
29
  function getEnv(varName, defaultValue) {
7
30
  try {
8
- const value = _optionalChain([process, 'optionalAccess', _ => _.env, 'optionalAccess', _2 => _2[varName]]);
31
+ const value = process?.env?.[varName];
9
32
  if (value) return value;
10
- } catch (e) {
33
+ } catch {
11
34
  }
12
35
  if (typeof defaultValue !== "string") {
13
36
  throw new MissingEnvVarError(`Missing process.env.${varName}`);
14
37
  }
15
38
  return defaultValue;
16
39
  }
17
-
18
-
19
-
20
- exports.MissingEnvVarError = MissingEnvVarError; exports.getEnv = getEnv;
40
+ // Annotate the CommonJS export names for ESM import in node:
41
+ 0 && (module.exports = {
42
+ MissingEnvVarError,
43
+ getEnv
44
+ });
package/getEnv.min.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }require('./chunk-QNNJNLGK.min.cjs');var t=class extends Error{};function r(n,s){try{let e=_optionalChain([process, 'optionalAccess', _ => _.env, 'optionalAccess', _2 => _2[n]]);if(e)return e}catch (e2){}if(typeof s!="string")throw new t(`Missing process.env.${n}`);return s}exports.MissingEnvVarError = t; exports.getEnv = r;
1
+ "use strict";var c=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var f=(t,n)=>{for(var s in n)c(t,s,{get:n[s],enumerable:!0})},l=(t,n,s,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let e of p(n))!g.call(t,e)&&e!==s&&c(t,e,{get:()=>n[e],enumerable:!(o=i(n,e))||o.enumerable});return t};var u=t=>l(c({},"__esModule",{value:!0}),t);var y={};f(y,{MissingEnvVarError:()=>r,getEnv:()=>x});module.exports=u(y);var r=class extends Error{};function x(t,n){try{let s=process?.env?.[t];if(s)return s}catch{}if(typeof n!="string")throw new r(`Missing process.env.${t}`);return n}0&&(module.exports={MissingEnvVarError,getEnv});
2
2
  //# sourceMappingURL=getEnv.min.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/choksheaklau/src/ts-utils/dist/getEnv.min.cjs","../src/getEnv.ts"],"names":["MissingEnvVarError","getEnv","varName","defaultValue","value"],"mappings":"AAAA,inBAAgC,ICGnBA,CAAAA,CAAN,MAAA,QAAiC,KAAM,CAAC,CAAA,CAQxC,SAASC,CAAAA,CAAOC,CAAAA,CAAiBC,CAAAA,CAAsC,CAC5E,GAAI,CACF,IAAMC,CAAAA,iBAAQ,OAAA,2BAAS,GAAA,4BAAA,CAAMF,CAAO,GAAA,CAIpC,EAAA,CAAIE,CAAAA,CAAO,OAAOA,CACpB,CAAA,UAAQ,CAER,CAEA,EAAA,CAAI,OAAOD,CAAAA,EAAiB,QAAA,CAC1B,MAAM,IAAIH,CAAAA,CAAmB,CAAA,oBAAA,EAAuBE,CAAO,CAAA,CAAA","file":"/Users/choksheaklau/src/ts-utils/dist/getEnv.min.cjs","sourcesContent":[null,"// eslint-disable-next-line @typescript-eslint/no-explicit-any\ndeclare const process: any;\n\nexport class MissingEnvVarError extends Error {}\n\n/**\n * Get an environment variable by name. If a default value is not given, and\n * the variable is empty or missing, throw MissingEnvVarError.\n *\n * If an empty string is acceptable, pass `defaultValue` as \"\".\n */\nexport function getEnv(varName: string, defaultValue?: string | null): string {\n try {\n const value = process?.env?.[varName];\n\n // This value should always be a string, unless the user sets it otherwise,\n // which is an unusual case.\n if (value) return value;\n } catch {\n // ignore\n }\n\n if (typeof defaultValue !== \"string\") {\n throw new MissingEnvVarError(`Missing process.env.${varName}`);\n }\n\n return defaultValue;\n}\n"]}
1
+ {"version":3,"sources":["../src/getEnv.ts"],"sourcesContent":["// eslint-disable-next-line @typescript-eslint/no-explicit-any\ndeclare const process: any;\n\nexport class MissingEnvVarError extends Error {}\n\n/**\n * Get an environment variable by name. If a default value is not given, and\n * the variable is empty or missing, throw MissingEnvVarError.\n *\n * If an empty string is acceptable, pass `defaultValue` as \"\".\n */\nexport function getEnv(varName: string, defaultValue?: string | null): string {\n try {\n const value = process?.env?.[varName];\n\n // This value should always be a string, unless the user sets it otherwise,\n // which is an unusual case.\n if (value) return value;\n } catch {\n // ignore\n }\n\n if (typeof defaultValue !== \"string\") {\n throw new MissingEnvVarError(`Missing process.env.${varName}`);\n }\n\n return defaultValue;\n}\n"],"mappings":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,wBAAAE,EAAA,WAAAC,IAAA,eAAAC,EAAAJ,GAGO,IAAME,EAAN,cAAiC,KAAM,CAAC,EAQxC,SAASC,EAAOE,EAAiBC,EAAsC,CAC5E,GAAI,CACF,IAAMC,EAAQ,SAAS,MAAMF,CAAO,EAIpC,GAAIE,EAAO,OAAOA,CACpB,MAAQ,CAER,CAEA,GAAI,OAAOD,GAAiB,SAC1B,MAAM,IAAIJ,EAAmB,uBAAuBG,CAAO,EAAE,EAG/D,OAAOC,CACT","names":["getEnv_exports","__export","MissingEnvVarError","getEnv","__toCommonJS","varName","defaultValue","value"]}
package/getEnv.min.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import"./chunk-UOU6IP3S.min.mjs";var t=class extends Error{};function r(n,s){try{let e=process?.env?.[n];if(e)return e}catch{}if(typeof s!="string")throw new t(`Missing process.env.${n}`);return s}export{t as MissingEnvVarError,r as getEnv};
1
+ var t=class extends Error{};function r(n,s){try{let e=process?.env?.[n];if(e)return e}catch{}if(typeof s!="string")throw new t(`Missing process.env.${n}`);return s}export{t as MissingEnvVarError,r as getEnv};
2
2
  //# sourceMappingURL=getEnv.min.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/getEnv.ts"],"sourcesContent":["// eslint-disable-next-line @typescript-eslint/no-explicit-any\ndeclare const process: any;\n\nexport class MissingEnvVarError extends Error {}\n\n/**\n * Get an environment variable by name. If a default value is not given, and\n * the variable is empty or missing, throw MissingEnvVarError.\n *\n * If an empty string is acceptable, pass `defaultValue` as \"\".\n */\nexport function getEnv(varName: string, defaultValue?: string | null): string {\n try {\n const value = process?.env?.[varName];\n\n // This value should always be a string, unless the user sets it otherwise,\n // which is an unusual case.\n if (value) return value;\n } catch {\n // ignore\n }\n\n if (typeof defaultValue !== \"string\") {\n throw new MissingEnvVarError(`Missing process.env.${varName}`);\n }\n\n return defaultValue;\n}\n"],"mappings":"iCAGO,IAAMA,EAAN,cAAiC,KAAM,CAAC,EAQxC,SAASC,EAAOC,EAAiBC,EAAsC,CAC5E,GAAI,CACF,IAAMC,EAAQ,SAAS,MAAMF,CAAO,EAIpC,GAAIE,EAAO,OAAOA,CACpB,MAAQ,CAER,CAEA,GAAI,OAAOD,GAAiB,SAC1B,MAAM,IAAIH,EAAmB,uBAAuBE,CAAO,EAAE,EAG/D,OAAOC,CACT","names":["MissingEnvVarError","getEnv","varName","defaultValue","value"]}
1
+ {"version":3,"sources":["../src/getEnv.ts"],"sourcesContent":["// eslint-disable-next-line @typescript-eslint/no-explicit-any\ndeclare const process: any;\n\nexport class MissingEnvVarError extends Error {}\n\n/**\n * Get an environment variable by name. If a default value is not given, and\n * the variable is empty or missing, throw MissingEnvVarError.\n *\n * If an empty string is acceptable, pass `defaultValue` as \"\".\n */\nexport function getEnv(varName: string, defaultValue?: string | null): string {\n try {\n const value = process?.env?.[varName];\n\n // This value should always be a string, unless the user sets it otherwise,\n // which is an unusual case.\n if (value) return value;\n } catch {\n // ignore\n }\n\n if (typeof defaultValue !== \"string\") {\n throw new MissingEnvVarError(`Missing process.env.${varName}`);\n }\n\n return defaultValue;\n}\n"],"mappings":"AAGO,IAAMA,EAAN,cAAiC,KAAM,CAAC,EAQxC,SAASC,EAAOC,EAAiBC,EAAsC,CAC5E,GAAI,CACF,IAAMC,EAAQ,SAAS,MAAMF,CAAO,EAIpC,GAAIE,EAAO,OAAOA,CACpB,MAAQ,CAER,CAEA,GAAI,OAAOD,GAAiB,SAC1B,MAAM,IAAIH,EAAmB,uBAAuBE,CAAO,EAAE,EAG/D,OAAOC,CACT","names":["MissingEnvVarError","getEnv","varName","defaultValue","value"]}
package/getEnv.mjs CHANGED
@@ -1,5 +1,3 @@
1
- import "./chunk-M6PYQYOX.mjs";
2
-
3
1
  // src/getEnv.ts
4
2
  var MissingEnvVarError = class extends Error {
5
3
  };
package/isEmpty.cjs CHANGED
@@ -1,9 +1,47 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
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);
2
19
 
3
-
4
- var _chunkNVLYXWLXcjs = require('./chunk-NVLYXWLX.cjs');
5
- require('./chunk-ILGTU46T.cjs');
6
- _chunkNVLYXWLXcjs.init_isEmpty.call(void 0, );
7
-
8
-
9
- exports.isEmpty = _chunkNVLYXWLXcjs.isEmpty;
20
+ // src/isEmpty.ts
21
+ var isEmpty_exports = {};
22
+ __export(isEmpty_exports, {
23
+ isEmpty: () => isEmpty
24
+ });
25
+ module.exports = __toCommonJS(isEmpty_exports);
26
+ function isEmpty(t) {
27
+ if (!t) {
28
+ return true;
29
+ }
30
+ if (typeof t !== "object") {
31
+ return false;
32
+ }
33
+ if ("length" in t) {
34
+ return t.length === 0;
35
+ }
36
+ if ("size" in t) {
37
+ return t.size === 0;
38
+ }
39
+ for (const k in t) {
40
+ return false;
41
+ }
42
+ return true;
43
+ }
44
+ // Annotate the CommonJS export names for ESM import in node:
45
+ 0 && (module.exports = {
46
+ isEmpty
47
+ });
package/isEmpty.min.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk6TQBMXTLmincjs = require('./chunk-6TQBMXTL.min.cjs');require('./chunk-QNNJNLGK.min.cjs');_chunk6TQBMXTLmincjs.b.call(void 0, );exports.isEmpty = _chunk6TQBMXTLmincjs.a;
1
+ "use strict";var t=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var o=Object.getOwnPropertyNames;var s=Object.prototype.hasOwnProperty;var l=(e,n)=>{for(var i in n)t(e,i,{get:n[i],enumerable:!0})},a=(e,n,i,u)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of o(n))!s.call(e,r)&&r!==i&&t(e,r,{get:()=>n[r],enumerable:!(u=f(n,r))||u.enumerable});return e};var c=e=>a(t({},"__esModule",{value:!0}),e);var b={};l(b,{isEmpty:()=>p});module.exports=c(b);function p(e){if(!e)return!0;if(typeof e!="object")return!1;if("length"in e)return e.length===0;if("size"in e)return e.size===0;for(let n in e)return!1;return!0}0&&(module.exports={isEmpty});
2
2
  //# sourceMappingURL=isEmpty.min.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/choksheaklau/src/ts-utils/dist/isEmpty.min.cjs"],"names":[],"mappings":"AAAA,wIAAyC,oCAAiC,oCAAE,CAAE,CAAC,yCAAoB","file":"/Users/choksheaklau/src/ts-utils/dist/isEmpty.min.cjs"}
1
+ {"version":3,"sources":["../src/isEmpty.ts"],"sourcesContent":["/**\n * Returns true if `t` is empty.\n */\nexport function isEmpty(t: unknown): boolean {\n // Anything falsy is considered empty.\n if (!t) {\n return true;\n }\n\n // Arrays are also of type `object`.\n if (typeof t !== \"object\") {\n return false;\n }\n\n // `length` includes arrays as well.\n if (\"length\" in t) {\n return t.length === 0;\n }\n\n // `size` is for Set, Map, Blob etc.\n if (\"size\" in t) {\n return t.size === 0;\n }\n\n // Super fast check for object emptiness.\n // https://stackoverflow.com/questions/679915/how-do-i-test-for-an-empty-javascript-object\n for (const k in t) {\n return false;\n }\n\n return true;\n}\n"],"mappings":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAGO,SAASE,EAAQE,EAAqB,CAE3C,GAAI,CAACA,EACH,MAAO,GAIT,GAAI,OAAOA,GAAM,SACf,MAAO,GAIT,GAAI,WAAYA,EACd,OAAOA,EAAE,SAAW,EAItB,GAAI,SAAUA,EACZ,OAAOA,EAAE,OAAS,EAKpB,QAAWC,KAAKD,EACd,MAAO,GAGT,MAAO,EACT","names":["isEmpty_exports","__export","isEmpty","__toCommonJS","t","k"]}
package/isEmpty.min.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import{a,b}from"./chunk-244NBT4Q.min.mjs";import"./chunk-UOU6IP3S.min.mjs";b();export{a as isEmpty};
1
+ function r(e){if(!e)return!0;if(typeof e!="object")return!1;if("length"in e)return e.length===0;if("size"in e)return e.size===0;for(let n in e)return!1;return!0}export{r as isEmpty};
2
2
  //# sourceMappingURL=isEmpty.min.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
1
+ {"version":3,"sources":["../src/isEmpty.ts"],"sourcesContent":["/**\n * Returns true if `t` is empty.\n */\nexport function isEmpty(t: unknown): boolean {\n // Anything falsy is considered empty.\n if (!t) {\n return true;\n }\n\n // Arrays are also of type `object`.\n if (typeof t !== \"object\") {\n return false;\n }\n\n // `length` includes arrays as well.\n if (\"length\" in t) {\n return t.length === 0;\n }\n\n // `size` is for Set, Map, Blob etc.\n if (\"size\" in t) {\n return t.size === 0;\n }\n\n // Super fast check for object emptiness.\n // https://stackoverflow.com/questions/679915/how-do-i-test-for-an-empty-javascript-object\n for (const k in t) {\n return false;\n }\n\n return true;\n}\n"],"mappings":"AAGO,SAASA,EAAQC,EAAqB,CAE3C,GAAI,CAACA,EACH,MAAO,GAIT,GAAI,OAAOA,GAAM,SACf,MAAO,GAIT,GAAI,WAAYA,EACd,OAAOA,EAAE,SAAW,EAItB,GAAI,SAAUA,EACZ,OAAOA,EAAE,OAAS,EAKpB,QAAWC,KAAKD,EACd,MAAO,GAGT,MAAO,EACT","names":["isEmpty","t","k"]}
package/isEmpty.mjs CHANGED
@@ -1,9 +1,22 @@
1
- import {
2
- init_isEmpty,
3
- isEmpty
4
- } from "./chunk-SDM2OPT6.mjs";
5
- import "./chunk-M6PYQYOX.mjs";
6
- init_isEmpty();
1
+ // src/isEmpty.ts
2
+ function isEmpty(t) {
3
+ if (!t) {
4
+ return true;
5
+ }
6
+ if (typeof t !== "object") {
7
+ return false;
8
+ }
9
+ if ("length" in t) {
10
+ return t.length === 0;
11
+ }
12
+ if ("size" in t) {
13
+ return t.size === 0;
14
+ }
15
+ for (const k in t) {
16
+ return false;
17
+ }
18
+ return true;
19
+ }
7
20
  export {
8
21
  isEmpty
9
22
  };
package/isPromise.cjs CHANGED
@@ -1,6 +1,29 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('./chunk-ILGTU46T.cjs');
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);
2
19
 
3
20
  // src/isPromise.ts
21
+ var isPromise_exports = {};
22
+ __export(isPromise_exports, {
23
+ isNativePromise: () => isNativePromise,
24
+ isPromise: () => isPromise
25
+ });
26
+ module.exports = __toCommonJS(isPromise_exports);
4
27
  function isPromise(obj) {
5
28
  if (!obj || typeof obj !== "object" && typeof obj !== "function") {
6
29
  return false;
@@ -10,7 +33,8 @@ function isPromise(obj) {
10
33
  function isNativePromise(obj) {
11
34
  return obj instanceof Promise;
12
35
  }
13
-
14
-
15
-
16
- exports.isNativePromise = isNativePromise; exports.isPromise = isPromise;
36
+ // Annotate the CommonJS export names for ESM import in node:
37
+ 0 && (module.exports = {
38
+ isNativePromise,
39
+ isPromise
40
+ });
package/isPromise.min.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('./chunk-QNNJNLGK.min.cjs');function e(n){return!n||typeof n!="object"&&typeof n!="function"?!1:"then"in n&&typeof n.then=="function"}function o(n){return n instanceof Promise}exports.isNativePromise = o; exports.isPromise = e;
1
+ "use strict";var t=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var c=(n,e)=>{for(var i in e)t(n,i,{get:e[i],enumerable:!0})},m=(n,e,i,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of u(e))!f.call(n,o)&&o!==i&&t(n,o,{get:()=>e[o],enumerable:!(r=s(e,o))||r.enumerable});return n};var p=n=>m(t({},"__esModule",{value:!0}),n);var w={};c(w,{isNativePromise:()=>k,isPromise:()=>P});module.exports=p(w);function P(n){return!n||typeof n!="object"&&typeof n!="function"?!1:"then"in n&&typeof n.then=="function"}function k(n){return n instanceof Promise}0&&(module.exports={isNativePromise,isPromise});
2
2
  //# sourceMappingURL=isPromise.min.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/choksheaklau/src/ts-utils/dist/isPromise.min.cjs","../src/isPromise.ts"],"names":["isPromise","obj","isNativePromise"],"mappings":"AAAA,6GAAgC,SCQhBA,CAAAA,CAAUC,CAAAA,CAAuC,CAE/D,MAAI,CAACA,CAAAA,EAAQ,OAAOA,CAAAA,EAAQ,QAAA,EAAY,OAAOA,CAAAA,EAAQ,UAAA,CAC9C,CAAA,CAAA,CAIF,MAAA,GAAUA,CAAAA,EAAO,OAAOA,CAAAA,CAAI,IAAA,EAAS,UAC9C,CASO,SAASC,CAAAA,CAAgBD,CAAAA,CAAuC,CACrE,OAAOA,EAAAA,WAAe,OACxB,CAAA,mDAAA","file":"/Users/choksheaklau/src/ts-utils/dist/isPromise.min.cjs","sourcesContent":[null,"/**\n * A type guard to check if an object is a Promise (or a \"thenable\"). It checks\n * if the object is not null, is an object, and has a callable .then method.\n *\n * Note that if the Promise expects a certain type like `Promise<T>`, there is\n * no way to validate the type of T unless we resolve the promise. This function\n * does not attempt to typecheck for T in any way.\n */\nexport function isPromise(obj: unknown): obj is Promise<unknown> {\n // Check if the object is defined and not null.\n if (!obj || (typeof obj !== \"object\" && typeof obj !== \"function\")) {\n return false;\n }\n\n // Check if the .then property is a function (callable).\n return \"then\" in obj && typeof obj.then === \"function\";\n}\n\n/**\n * A type guard to check if an object is a native Promise.\n *\n * Note that if the Promise expects a certain type like `Promise<T>`, there is\n * no way to validate the type of T unless we resolve the promise. This function\n * does not attempt to typecheck for T in any way.\n */\nexport function isNativePromise(obj: unknown): obj is Promise<unknown> {\n return obj instanceof Promise;\n}\n"]}
1
+ {"version":3,"sources":["../src/isPromise.ts"],"sourcesContent":["/**\n * A type guard to check if an object is a Promise (or a \"thenable\"). It checks\n * if the object is not null, is an object, and has a callable .then method.\n *\n * Note that if the Promise expects a certain type like `Promise<T>`, there is\n * no way to validate the type of T unless we resolve the promise. This function\n * does not attempt to typecheck for T in any way.\n */\nexport function isPromise(obj: unknown): obj is Promise<unknown> {\n // Check if the object is defined and not null.\n if (!obj || (typeof obj !== \"object\" && typeof obj !== \"function\")) {\n return false;\n }\n\n // Check if the .then property is a function (callable).\n return \"then\" in obj && typeof obj.then === \"function\";\n}\n\n/**\n * A type guard to check if an object is a native Promise.\n *\n * Note that if the Promise expects a certain type like `Promise<T>`, there is\n * no way to validate the type of T unless we resolve the promise. This function\n * does not attempt to typecheck for T in any way.\n */\nexport function isNativePromise(obj: unknown): obj is Promise<unknown> {\n return obj instanceof Promise;\n}\n"],"mappings":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qBAAAE,EAAA,cAAAC,IAAA,eAAAC,EAAAJ,GAQO,SAASG,EAAUE,EAAuC,CAE/D,MAAI,CAACA,GAAQ,OAAOA,GAAQ,UAAY,OAAOA,GAAQ,WAC9C,GAIF,SAAUA,GAAO,OAAOA,EAAI,MAAS,UAC9C,CASO,SAASH,EAAgBG,EAAuC,CACrE,OAAOA,aAAe,OACxB","names":["isPromise_exports","__export","isNativePromise","isPromise","__toCommonJS","obj"]}
package/isPromise.min.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import"./chunk-UOU6IP3S.min.mjs";function e(n){return!n||typeof n!="object"&&typeof n!="function"?!1:"then"in n&&typeof n.then=="function"}function o(n){return n instanceof Promise}export{o as isNativePromise,e as isPromise};
1
+ function e(n){return!n||typeof n!="object"&&typeof n!="function"?!1:"then"in n&&typeof n.then=="function"}function o(n){return n instanceof Promise}export{o as isNativePromise,e as isPromise};
2
2
  //# sourceMappingURL=isPromise.min.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/isPromise.ts"],"sourcesContent":["/**\n * A type guard to check if an object is a Promise (or a \"thenable\"). It checks\n * if the object is not null, is an object, and has a callable .then method.\n *\n * Note that if the Promise expects a certain type like `Promise<T>`, there is\n * no way to validate the type of T unless we resolve the promise. This function\n * does not attempt to typecheck for T in any way.\n */\nexport function isPromise(obj: unknown): obj is Promise<unknown> {\n // Check if the object is defined and not null.\n if (!obj || (typeof obj !== \"object\" && typeof obj !== \"function\")) {\n return false;\n }\n\n // Check if the .then property is a function (callable).\n return \"then\" in obj && typeof obj.then === \"function\";\n}\n\n/**\n * A type guard to check if an object is a native Promise.\n *\n * Note that if the Promise expects a certain type like `Promise<T>`, there is\n * no way to validate the type of T unless we resolve the promise. This function\n * does not attempt to typecheck for T in any way.\n */\nexport function isNativePromise(obj: unknown): obj is Promise<unknown> {\n return obj instanceof Promise;\n}\n"],"mappings":"iCAQO,SAASA,EAAUC,EAAuC,CAE/D,MAAI,CAACA,GAAQ,OAAOA,GAAQ,UAAY,OAAOA,GAAQ,WAC9C,GAIF,SAAUA,GAAO,OAAOA,EAAI,MAAS,UAC9C,CASO,SAASC,EAAgBD,EAAuC,CACrE,OAAOA,aAAe,OACxB","names":["isPromise","obj","isNativePromise"]}
1
+ {"version":3,"sources":["../src/isPromise.ts"],"sourcesContent":["/**\n * A type guard to check if an object is a Promise (or a \"thenable\"). It checks\n * if the object is not null, is an object, and has a callable .then method.\n *\n * Note that if the Promise expects a certain type like `Promise<T>`, there is\n * no way to validate the type of T unless we resolve the promise. This function\n * does not attempt to typecheck for T in any way.\n */\nexport function isPromise(obj: unknown): obj is Promise<unknown> {\n // Check if the object is defined and not null.\n if (!obj || (typeof obj !== \"object\" && typeof obj !== \"function\")) {\n return false;\n }\n\n // Check if the .then property is a function (callable).\n return \"then\" in obj && typeof obj.then === \"function\";\n}\n\n/**\n * A type guard to check if an object is a native Promise.\n *\n * Note that if the Promise expects a certain type like `Promise<T>`, there is\n * no way to validate the type of T unless we resolve the promise. This function\n * does not attempt to typecheck for T in any way.\n */\nexport function isNativePromise(obj: unknown): obj is Promise<unknown> {\n return obj instanceof Promise;\n}\n"],"mappings":"AAQO,SAASA,EAAUC,EAAuC,CAE/D,MAAI,CAACA,GAAQ,OAAOA,GAAQ,UAAY,OAAOA,GAAQ,WAC9C,GAIF,SAAUA,GAAO,OAAOA,EAAI,MAAS,UAC9C,CASO,SAASC,EAAgBD,EAAuC,CACrE,OAAOA,aAAe,OACxB","names":["isPromise","obj","isNativePromise"]}
package/isPromise.mjs CHANGED
@@ -1,5 +1,3 @@
1
- import "./chunk-M6PYQYOX.mjs";
2
-
3
1
  // src/isPromise.ts
4
2
  function isPromise(obj) {
5
3
  if (!obj || typeof obj !== "object" && typeof obj !== "function") {