This commit is contained in:
Asaki Yuki 2026-01-04 10:52:31 +07:00
commit e2f472d802
83 changed files with 6338 additions and 0 deletions

17
scripts/custom.ts Normal file
View file

@ -0,0 +1,17 @@
export {} // 👈 BẮT BUỘC
declare global {
interface String {
toCamelCase(upcaseTop?: boolean): string
toSnakeCase(): string
}
}
String.prototype.toCamelCase = function (this: string, upcaseTop: boolean): string {
const a = this.replace(/_([a-z])/g, g => g[1].toUpperCase())
return upcaseTop ? a.charAt(0).toUpperCase() + a.slice(1) : a
}
String.prototype.toSnakeCase = function (this: string): string {
return this.replace(/([A-Z])/g, "_$1").toLowerCase()
}