chore: rename filters to snake style, #487

BREAKING CHANGE: keys in `<liquidjs>.filters` are now in snake case (instead of camel case), identical to that in Liquid template.
This commit is contained in:
Jun Yang
2022-11-27 14:04:00 +08:00
parent 907c4dea06
commit ff112a4750
38 changed files with 119 additions and 125 deletions
-7
View File
@@ -137,13 +137,6 @@ export function identify<T> (val: T): T {
return val
}
export function snakeCase (str: string) {
return str.replace(
/(\w?)([A-Z])/g,
(_, a, b) => (a ? a + '_' : '') + b.toLowerCase()
)
}
export function changeCase (str: string): string {
const hasLowerCase = [...str].some(ch => ch >= 'a' && ch <= 'z')
return hasLowerCase ? str.toUpperCase() : str.toLowerCase()