1.0.3 • Published 6 years ago

camelcasejs v1.0.3

Weekly downloads
114
License
MIT
Repository
github
Last release
6 years ago

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