@thisisagile/easy 17.4.3 → 17.4.5
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/dist/index.d.ts +1 -0
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -0
- package/dist/index.mjs.map +1 -1
- package/dist/utils/Seconds.d.ts +9 -0
- package/dist/utils/Seconds.mjs +39 -0
- package/dist/utils/Seconds.mjs.map +1 -0
- package/package.json +2 -2
- package/src/index.ts +1 -0
- package/src/utils/Seconds.ts +24 -0
package/dist/index.d.ts
CHANGED
|
@@ -101,6 +101,7 @@ export * from './utils/Log';
|
|
|
101
101
|
export * from './utils/Mapper';
|
|
102
102
|
export * from './utils/Promise';
|
|
103
103
|
export * from './utils/Property';
|
|
104
|
+
export * from './utils/Seconds';
|
|
104
105
|
export * from './utils/State';
|
|
105
106
|
export * from './utils/Sentence';
|
|
106
107
|
export * from './utils/Traverse';
|
package/dist/index.js
CHANGED
|
@@ -232,6 +232,7 @@ __export(src_exports, {
|
|
|
232
232
|
rest: () => rest,
|
|
233
233
|
rule: () => rule,
|
|
234
234
|
searchable: () => searchable,
|
|
235
|
+
seconds: () => seconds,
|
|
235
236
|
singleton: () => singleton,
|
|
236
237
|
tag: () => tag,
|
|
237
238
|
template: () => template,
|
|
@@ -3194,6 +3195,26 @@ function dir(t) {
|
|
|
3194
3195
|
return t;
|
|
3195
3196
|
}
|
|
3196
3197
|
|
|
3198
|
+
// src/utils/Seconds.ts
|
|
3199
|
+
var seconds = {
|
|
3200
|
+
toDuration: (s) => {
|
|
3201
|
+
const seconds2 = s % 60;
|
|
3202
|
+
const minutes = Math.floor(s / 60) % 60;
|
|
3203
|
+
const hours = Math.floor(s / 3600) % 24;
|
|
3204
|
+
const days2 = Math.floor(s / 86400);
|
|
3205
|
+
return { days: days2, hours, minutes, seconds: seconds2 };
|
|
3206
|
+
},
|
|
3207
|
+
toText: (s) => {
|
|
3208
|
+
const { days: days2, hours, minutes, seconds: secs } = seconds.toDuration(s);
|
|
3209
|
+
return toList(
|
|
3210
|
+
ifTrue(days2, (d) => `${d}d`),
|
|
3211
|
+
ifTrue(hours, (h) => `${h}h`),
|
|
3212
|
+
ifTrue(minutes, (m) => `${m}m`),
|
|
3213
|
+
ifTrue(days2 + hours + minutes === 0, `${secs}s`)
|
|
3214
|
+
).mapDefined((s2) => s2).join(" ");
|
|
3215
|
+
}
|
|
3216
|
+
};
|
|
3217
|
+
|
|
3197
3218
|
// src/utils/Sentence.ts
|
|
3198
3219
|
var Sentence = class {
|
|
3199
3220
|
constructor(word, pre, sentence = (pre?.sentence ?? []).concat(word)) {
|
|
@@ -3450,6 +3471,7 @@ var wait = (millis) => Wait.wait(millis);
|
|
|
3450
3471
|
rest,
|
|
3451
3472
|
rule,
|
|
3452
3473
|
searchable,
|
|
3474
|
+
seconds,
|
|
3453
3475
|
singleton,
|
|
3454
3476
|
tag,
|
|
3455
3477
|
template,
|