This package contains tools for changing casing.
Each strategy encapsulates specific casing. Strategy can:
-
parse
string to tokens -
join
tokens to string
List of available strategies (name - casing example = tokens):
-
Snake
-snake_case_42
= [snake, case, 42] -
Const
-CONST_CASE_42
= [CONST, CASE, 42] -
Kebab
-kebab-case-42
= [kebab, case, 42] -
Camel
-camelCase42
= [camel, Case, 42] -
Pascal
-PascalCase42
= [Pascal, Case, 42] -
Unknown
-foo_BarBaz42-buzz
= [foo, Bar, Baz, 42, buzz]
Creates Strategy based on passed strategy name. Throws Error on unexisting strategy.
Encapsulates casing-to-casing transformation.
Performs deep casing transform in passed object. Supports:
- ignore predicate: if true, then string won't be transformed;
- type of result;
Uses factory to deep transform, but in single-use way. Also supports ignore predicate and result type.
They are functions with preconfigured transformers.
Imported from @ocelotjungle/case-converters/presets