Skip to content

Latest commit

 

History

History
31 lines (20 loc) · 942 Bytes

README.md

File metadata and controls

31 lines (20 loc) · 942 Bytes

Change Case

Change Case is based on just. It provides helpers to convert strings to camel, pascal, kebab, snake lower & upper cases

Installation

npm i @rocketstation/change-case

Usage

import * as cc from '@rocketstation/change-case'

console.log(cc.c('foo bar', ['foo', 'bar'], 'foo', 'bar')) // fooBarFooBarFooBar
console.log(cc.p('foo bar', ['foo', 'bar'], 'foo', 'bar')) // FooBarFooBarFooBar
console.log(cc.sl('foo bar', ['foo', 'bar'], 'foo', 'bar')) // foo_bar_foo_bar_foo_bar
console.log(cc.su('foo bar', ['foo', 'bar'], 'foo', 'bar')) // FOO_BAR_FOO_BAR_FOO_BAR
console.log(cc.k('foo bar', ['foo', 'bar'], 'foo', 'bar')) // foo-bar-foo-bar-foo-bar

Motivation

We were tired of writing this code again and again

License

Change Case is licensed under the MIT License

Created by RocketStation