@ocelotjungle/case-converters
v1.0.0
Published
Tools to switch name's casings
Downloads
2
Readme
@ocelotjungle/case-converters
This package contains tools for changing casing.
Tools
Strategies
Each strategy encapsulates specific casing. Strategy can:
parse
string to tokensjoin
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]
Strategy Factory
Creates Strategy based on passed strategy name. Throws Error on unexisting strategy.
CaseTransformer
Encapsulates casing-to-casing transformation.
Deep Transform Factory
Performs deep casing transform in passed object. Supports:
- ignore predicate: if true, then string won't be transformed;
- type of result;
Deep Transform Method
Uses factory to deep transform, but in single-use way. Also supports ignore predicate and result type.
Presets
They are functions with preconfigured transformers.
Imported from @ocelotjungle/case-converters/presets