camelcasejs

1.0.3 • Public • Published

CamelCase JS

String to CamelCase or CamelCase to string: foo-barfooBar

Install

$ npm install --save camelcasejs

Methods

  • CamelCase
    • Convert string/array to CamelCase format
  • DeCamelize
    • Convert CamelCase format to string

Examples

CamelCase

// Import
const { CamelCase } = require('camelcasejs');
 
CamelCase('foo-bar');
// Response = 'fooBar'
 
CamelCase('foo_bar');
// Response = 'fooBar'
 
CamelCase('Foo-Bar');
// Response = 'fooBar'
 
CamelCase('--foo.bar');
// Response = 'fooBar'
 
CamelCase('__foo__bar__');
// Response = 'fooBar'
 
CamelCase('foo bar');
// Response = 'fooBar'

Array

// Import
const { CamelCase } = require('camelcasejs');
 
CamelCase(['foo', 'bar']);
// Response = 'fooBar'

DeCamelize

// Import
const { DeCamelize } = require('camelcasejs');
 
DeCamelize('fooBar');
// Response = 'foo_bar'
 
DeCamelize('fooBarV9_2');
// Response = 'foo_bar_v9.2'
 
/* Custom separator */
DeCamelize('fooBar', '=');
// Response = 'foo=bar'
 
DeCamelize('fooBarV9_2', '-');
// Response = 'foo-bar-v9.2'

License

MIT © Julio Sansossio

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.3
    13
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.3
    13
  • 1.0.2
    1
  • 1.0.1
    1
  • 1.0.0
    1

Package Sidebar

Install

npm i camelcasejs

Weekly Downloads

16

Version

1.0.3

License

MIT

Unpacked Size

7.15 kB

Total Files

8

Last publish

Collaborators

  • sansossio