mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-16 21:00:40 -07:00
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:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user