rebase
This commit is contained in:
commit
e2f472d802
83 changed files with 6338 additions and 0 deletions
17
scripts/custom.ts
Normal file
17
scripts/custom.ts
Normal 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()
|
||||
}
|
||||
Reference in a new issue