@wavy/fn 0.0.12 → 0.0.13
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/main.cjs +11 -8
- package/dist/main.d.cts +2 -1
- package/dist/main.d.ts +2 -1
- package/dist/main.js +11 -8
- package/package.json +32 -1
- package/publish.js +8 -8
package/dist/main.cjs
CHANGED
|
@@ -357,9 +357,12 @@ var TimeManager = class _TimeManager {
|
|
|
357
357
|
const convertedDate = typeof time === "number" ? new Date(time) : time === "now" ? new Date(Date.now()) : time;
|
|
358
358
|
let options = {};
|
|
359
359
|
switch (format2) {
|
|
360
|
-
case "
|
|
360
|
+
case "hh:mm A":
|
|
361
361
|
options = { hour: "numeric", minute: "2-digit" };
|
|
362
362
|
break;
|
|
363
|
+
case "hh:mm:ss A":
|
|
364
|
+
options = { hour: "numeric", minute: "2-digit", second: "2-digit" };
|
|
365
|
+
break;
|
|
363
366
|
case "mm/dd/yyyy":
|
|
364
367
|
options = {
|
|
365
368
|
year: "numeric",
|
|
@@ -367,7 +370,7 @@ var TimeManager = class _TimeManager {
|
|
|
367
370
|
day: "2-digit"
|
|
368
371
|
};
|
|
369
372
|
break;
|
|
370
|
-
case "mm/dd/yyyy
|
|
373
|
+
case "mm/dd/yyyy hh:mm A":
|
|
371
374
|
options = {
|
|
372
375
|
year: "numeric",
|
|
373
376
|
month: "2-digit",
|
|
@@ -393,11 +396,11 @@ var TimeManager = class _TimeManager {
|
|
|
393
396
|
const year = this.format(convertedDate, "yyyy");
|
|
394
397
|
return `${month} ${year}`;
|
|
395
398
|
}
|
|
396
|
-
if (format2 === "
|
|
399
|
+
if (format2 === "hh:mm A" || format2 === "hh:mm:ss A")
|
|
397
400
|
return takeLastWhile(fmtDate.split(""), (char) => char !== ",").join("").trim();
|
|
398
|
-
if (format2 === "MMM dd, yyyy |
|
|
399
|
-
const delimiter = format2 === "MMM dd, yyyy at
|
|
400
|
-
const time2 = this.format(convertedDate, "
|
|
401
|
+
if (format2 === "MMM dd, yyyy | hh:mm A" || format2 === "MMM dd, yyyy at hh:mm A") {
|
|
402
|
+
const delimiter = format2 === "MMM dd, yyyy at hh:mm A" ? "at" : "|";
|
|
403
|
+
const time2 = this.format(convertedDate, "hh:mm A");
|
|
401
404
|
return [fmtDate, time2].join(` ${delimiter} `);
|
|
402
405
|
}
|
|
403
406
|
return fmtDate;
|
|
@@ -439,7 +442,7 @@ var TimeManager = class _TimeManager {
|
|
|
439
442
|
return fmtDuration;
|
|
440
443
|
}
|
|
441
444
|
getTimeOfDay() {
|
|
442
|
-
const time = this.format("now", "
|
|
445
|
+
const time = this.format("now", "hh:mm A");
|
|
443
446
|
const amOrPm = takeLast(time.split(""), 2).join("");
|
|
444
447
|
const hour = parseInt(
|
|
445
448
|
takeWhile(time.split(""), (value) => value !== ":").join("")
|
|
@@ -464,7 +467,7 @@ function fileToLocalFile(file, options) {
|
|
|
464
467
|
})()?.trim?.();
|
|
465
468
|
const { name: _, size: __, ..._metadata } = file;
|
|
466
469
|
return {
|
|
467
|
-
uid: (0, import_uuid.v4)(),
|
|
470
|
+
uid: options?.uid || (0, import_uuid.v4)(),
|
|
468
471
|
description: options?.description,
|
|
469
472
|
path: options?.filepath || file?.webkitRelativePath,
|
|
470
473
|
typeAlias: options?.typeAlias || run(
|
package/dist/main.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "@wavy/types"
|
|
2
|
-
type DateFormat = "MMM dd, yyyy" | "MMM dd, yyyy |
|
|
2
|
+
type DateFormat = "MMM dd, yyyy" | "MMM dd, yyyy | hh:mm A" | "MMM dd, yyyy at hh:mm A" | "MMMM" | "yyyy" | "MMM yyyy" | "mm/dd/yyyy" | "mm/dd/yyyy hh:mm A" | "hh:mm A" | "hh:mm:ss A";
|
|
3
3
|
|
|
4
4
|
type NumberFormatterTypes = {
|
|
5
5
|
formats: "money";
|
|
@@ -33,6 +33,7 @@ declare class StringFormatter {
|
|
|
33
33
|
|
|
34
34
|
declare const toObject: {
|
|
35
35
|
(file: File | Pick<File, "name" | "size" | "type" | "webkitRelativePath" | "lastModified">, options?: Partial<{
|
|
36
|
+
uid?: string;
|
|
36
37
|
uploadDate: number | "now";
|
|
37
38
|
description: string;
|
|
38
39
|
filepath: string;
|
package/dist/main.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "@wavy/types"
|
|
2
|
-
type DateFormat = "MMM dd, yyyy" | "MMM dd, yyyy |
|
|
2
|
+
type DateFormat = "MMM dd, yyyy" | "MMM dd, yyyy | hh:mm A" | "MMM dd, yyyy at hh:mm A" | "MMMM" | "yyyy" | "MMM yyyy" | "mm/dd/yyyy" | "mm/dd/yyyy hh:mm A" | "hh:mm A" | "hh:mm:ss A";
|
|
3
3
|
|
|
4
4
|
type NumberFormatterTypes = {
|
|
5
5
|
formats: "money";
|
|
@@ -33,6 +33,7 @@ declare class StringFormatter {
|
|
|
33
33
|
|
|
34
34
|
declare const toObject: {
|
|
35
35
|
(file: File | Pick<File, "name" | "size" | "type" | "webkitRelativePath" | "lastModified">, options?: Partial<{
|
|
36
|
+
uid?: string;
|
|
36
37
|
uploadDate: number | "now";
|
|
37
38
|
description: string;
|
|
38
39
|
filepath: string;
|
package/dist/main.js
CHANGED
|
@@ -259,9 +259,12 @@ var TimeManager = class _TimeManager {
|
|
|
259
259
|
const convertedDate = typeof time === "number" ? new Date(time) : time === "now" ? new Date(Date.now()) : time;
|
|
260
260
|
let options = {};
|
|
261
261
|
switch (format2) {
|
|
262
|
-
case "
|
|
262
|
+
case "hh:mm A":
|
|
263
263
|
options = { hour: "numeric", minute: "2-digit" };
|
|
264
264
|
break;
|
|
265
|
+
case "hh:mm:ss A":
|
|
266
|
+
options = { hour: "numeric", minute: "2-digit", second: "2-digit" };
|
|
267
|
+
break;
|
|
265
268
|
case "mm/dd/yyyy":
|
|
266
269
|
options = {
|
|
267
270
|
year: "numeric",
|
|
@@ -269,7 +272,7 @@ var TimeManager = class _TimeManager {
|
|
|
269
272
|
day: "2-digit"
|
|
270
273
|
};
|
|
271
274
|
break;
|
|
272
|
-
case "mm/dd/yyyy
|
|
275
|
+
case "mm/dd/yyyy hh:mm A":
|
|
273
276
|
options = {
|
|
274
277
|
year: "numeric",
|
|
275
278
|
month: "2-digit",
|
|
@@ -295,11 +298,11 @@ var TimeManager = class _TimeManager {
|
|
|
295
298
|
const year = this.format(convertedDate, "yyyy");
|
|
296
299
|
return `${month} ${year}`;
|
|
297
300
|
}
|
|
298
|
-
if (format2 === "
|
|
301
|
+
if (format2 === "hh:mm A" || format2 === "hh:mm:ss A")
|
|
299
302
|
return takeLastWhile(fmtDate.split(""), (char) => char !== ",").join("").trim();
|
|
300
|
-
if (format2 === "MMM dd, yyyy |
|
|
301
|
-
const delimiter = format2 === "MMM dd, yyyy at
|
|
302
|
-
const time2 = this.format(convertedDate, "
|
|
303
|
+
if (format2 === "MMM dd, yyyy | hh:mm A" || format2 === "MMM dd, yyyy at hh:mm A") {
|
|
304
|
+
const delimiter = format2 === "MMM dd, yyyy at hh:mm A" ? "at" : "|";
|
|
305
|
+
const time2 = this.format(convertedDate, "hh:mm A");
|
|
303
306
|
return [fmtDate, time2].join(` ${delimiter} `);
|
|
304
307
|
}
|
|
305
308
|
return fmtDate;
|
|
@@ -341,7 +344,7 @@ var TimeManager = class _TimeManager {
|
|
|
341
344
|
return fmtDuration;
|
|
342
345
|
}
|
|
343
346
|
getTimeOfDay() {
|
|
344
|
-
const time = this.format("now", "
|
|
347
|
+
const time = this.format("now", "hh:mm A");
|
|
345
348
|
const amOrPm = takeLast(time.split(""), 2).join("");
|
|
346
349
|
const hour = parseInt(
|
|
347
350
|
takeWhile(time.split(""), (value) => value !== ":").join("")
|
|
@@ -366,7 +369,7 @@ function fileToLocalFile(file, options) {
|
|
|
366
369
|
})()?.trim?.();
|
|
367
370
|
const { name: _, size: __, ..._metadata } = file;
|
|
368
371
|
return {
|
|
369
|
-
uid: v4(),
|
|
372
|
+
uid: options?.uid || v4(),
|
|
370
373
|
description: options?.description,
|
|
371
374
|
path: options?.filepath || file?.webkitRelativePath,
|
|
372
375
|
typeAlias: options?.typeAlias || run(
|
package/package.json
CHANGED
|
@@ -1 +1,32 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"name": "@wavy/fn",
|
|
3
|
+
"version": "0.0.13",
|
|
4
|
+
"main": "./dist/main.js",
|
|
5
|
+
"module": "./dist/main.cjs",
|
|
6
|
+
"types": "./dist/main.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "tsup && node prepend"
|
|
9
|
+
},
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://github.com/justVibes/literate-succotash.git"
|
|
13
|
+
},
|
|
14
|
+
"keywords": [],
|
|
15
|
+
"author": "",
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"type": "module",
|
|
18
|
+
"bugs": {
|
|
19
|
+
"url": "https://github.com/justVibes/literate-succotash/issues"
|
|
20
|
+
},
|
|
21
|
+
"homepage": "https://github.com/justVibes/literate-succotash#readme",
|
|
22
|
+
"description": "",
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@types/node": "^24.5.2",
|
|
25
|
+
"@wavy/types": "^0.0.32",
|
|
26
|
+
"tsup": "^8.5.0",
|
|
27
|
+
"typescript": "^5.9.2"
|
|
28
|
+
},
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"uuid": "^13.0.0"
|
|
31
|
+
}
|
|
32
|
+
}
|
package/publish.js
CHANGED
|
@@ -6,15 +6,15 @@ import("child_process").then(async ({ exec }) => {
|
|
|
6
6
|
);
|
|
7
7
|
const version = jsonPackage.version;
|
|
8
8
|
let newVersion = "";
|
|
9
|
-
const updateVersion = () => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
fs.writeFileSync("./package.json", JSON.stringify(jsonPackage));
|
|
9
|
+
const updateVersion = async () => {
|
|
10
|
+
return new Promise((res, rej) => {
|
|
11
|
+
exec("npm version patch", (err, stdout, stderr) => {
|
|
12
|
+
if (err) rej(err);
|
|
13
|
+
res({ stdout, stderr });
|
|
14
|
+
});
|
|
15
|
+
});
|
|
17
16
|
};
|
|
17
|
+
updateVersion();
|
|
18
18
|
exec("npm run build && npm publish", async (err) => {
|
|
19
19
|
const overwriteVersionError = `Cannot implicitly apply the "latest" tag because published version ${version} is higher than the new version ${version}.`;
|
|
20
20
|
const getSuccessMessage = (tries = 1) =>
|