naming-conventions
TypeScript icon, indicating that this package has built-in type declarations

1.1.1 • Public • Published

JavaScript naming conventions conversion

JavaScript NamingConventions class which allows one to easily convert strings between namingConventions.

Prerequisites

None :).

Installation

yarn add naming-conventions

Features

Four different naming conventions are available:

  • camelCase
  • PascalCase
  • snake_case
  • kebab-case

Convert string from given convention to another

NamingConventions.convert('someString')
    .from(NamingConventions.camelCase)
    .to(NamingConventions.kebabCase) // 'some-string'

Convert a string with an unknown convention

You can omit the '.from' part in conversion. That causes the input string to be parsed and auto converted to desired target convention. You should prefer to provide the input convention as this method is much more performant.

NamingConventions.convert('someString')
    .to(NamingConventions.kebabCase) // 'some-string'

Extending

You can add more conventions by using the NamingConventions.addConvention method.

Readme

Keywords

none

Package Sidebar

Install

npm i naming-conventions

Weekly Downloads

4

Version

1.1.1

License

MIT

Unpacked Size

44.7 kB

Total Files

17

Last publish

Collaborators

  • rodziu