aboutsummaryrefslogtreecommitdiff
path: root/deno/base/lib.ts
diff options
context:
space:
mode:
Diffstat (limited to 'deno/base/lib.ts')
-rw-r--r--deno/base/lib.ts10
1 files changed, 10 insertions, 0 deletions
diff --git a/deno/base/lib.ts b/deno/base/lib.ts
new file mode 100644
index 0000000..a5e4a6a
--- /dev/null
+++ b/deno/base/lib.ts
@@ -0,0 +1,10 @@
+export function camelCaseToKebabCase(str: string): string {
+ return str.replace(/[A-Z]/g, (m) => "-" + m.toLowerCase());
+}
+
+export function toFileNameString(date: Date, dateOnly?: boolean): string {
+ const str = date.toISOString();
+ return dateOnly === true
+ ? str.slice(0, str.indexOf("T"))
+ : str.replaceAll(/:|\./g, "-");
+}