aboutsummaryrefslogtreecommitdiff
path: root/deno/base/lib.ts
blob: a5e4a6a77fc6e96fcbf289896495552ac046a3c3 (plain)
1
2
3
4
5
6
7
8
9
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, "-");
}