0.3.8 • Published 2 months ago

convconv v0.3.8

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

ConvConv

Super simple, zero dependency naming convention converter and validator library.

Cli

As of version 0.3.3 there is cli version of convconv available. Use the following command to install it globally onto your system. npm i -g convconv You can see help for cli by running the following command. convconv --help

Examples

import convconv from "convconv";

// examples:
//   camelCase
//   kebab-case
//   PascalCase
//   snake_case
//   SCREAMING-KEBAB-CASE
//   SCREAMING_SNAKE_CASE

// converts camelCase to kebab-case
// camelCase -> camel-case
convconv.fromCamel("camelCase").toKebab();

// converts kebab-case to snake_case
// kebab-case -> kebab_case
convconv.fromConvention("kebab", "kebab-case").toSnake();

// converts any case to PascalCase
convconv
  .autoFrom("your-input-in-one-of-available-naming-conventions")
  .toPascal();

// throws ConventionNotFoundError
convconv.autoFrom("Random_sTring-with_nOConvention");

// returns 'kebab'
convconv.getConvention("some-kebab-case-string");

// throws ConventionNotFoundError
convconv.getConvention("Random_sTring-with_nOConvention");

// returns true
convconv.isPascal("PascalCase");

// returns true
convconv.isConvention("pascal", "PascalCase");

// throws ConventionViolationError
convconv.fromKebab("NotKebab");

// throws ConventionViolationError
convconv.fromCamel("123startingWithNumber");

Errors

All errors extend from ConvConvError.

0.3.8

2 months ago

0.3.6

2 months ago

0.3.5

2 months ago

0.3.7

2 months ago

0.3.4

2 months ago

0.3.3

2 months ago

0.3.2

2 months ago

0.3.1

2 months ago

0.3.0

8 months ago

0.2.1

8 months ago

0.2.0

8 months ago

0.1.1

8 months ago

0.1.0

8 months ago

0.0.4

8 months ago

0.0.3

8 months ago

0.0.2

8 months ago

0.0.1

8 months ago