Easily Convert and Validate Naming Conventions with Convconv

Category: Javascript | September 24, 2023
Author:TheKhanj
Views Total:13 views
Official Page:Go to website
Last Update:September 24, 2023
License:MIT

Preview:

Easily Convert and Validate Naming Conventions with Convconv

Description:

convconv is a dependency-free JavaScript library that provides a simple way to convert and validate naming conventions.

It allows developers to easily switch between popular naming styles like camelCase, kebab-case, PascalCase, and snake_case. The library handles all the heavy lifting, removing the need to write custom conversion and validation logic.

See Also:

How to use it:

1. Install and import the Convconv into your project.

# NPM
$ npm i convconv
import convconv from 'convconv';

2. Convert between different naming conventions.

// => css-script
convconv.fromCamel('cssScript').toKebab()
// => css_script
convconv.fromConvention('kebab', 'css-script').toSnake()
// => CssScript
convconv.autoFrom('css-script').toPascal();

3. Get naming conventions from strings.

// => kebab
convconv.getConvention('css-script');
// => snake
convconv.getConvention('css_script');
// => pascal
convconv.getConvention('CssScript');

4. Validate naming conventions.

// => true
convconv.isPascal('CssScript');
// OR
convconv.isConvention('pascal', 'CssScript');

Changelog:

09/24/2023

  • add screaming snake case and differentiate between it and screaming

You Might Be Interested In:


Leave a Reply