mOcKiNgCaSe
Convert a string to mOcKiNgCaSe.
Read more on wikipedia Studly caps.
Inspired by the meme Mocking Spongebob and http://dannypage.github.io/spongebob.html
Install
$ npm install mockingcase --save
Usage
const mOcKiNgCaSe = ;// es6 - import mOcKiNgCaSe from 'mockingcase';// ts - import * as mOcKiNgCaSe from 'mockingcase';// ts - import mOcKiNgCaSe = require('mockingcase'); ;//=> 'fOo-bAr' ;//=> 'aA' ;//=> 'aa'//=> 'aA'//=> 'Aa'//=> 'AA' ;//=> '42fOo!bAr' ;//=> 'aA' ;//=> 'aA' ;//=> 'FoO BaR' ;//=> 'Foo'//=> 'FOo'//=> 'FoO'//=> 'FOO' ;//=> 'fOoBaR' ;//=> Error "An input is required" mOcKiNgCaSe;// console.log('fOo bAr'); // Optionally create String.prototype.toMockingCasemOcKiNgCaSe; 'foo_bar';//=> 'fOo_bAr' 'foo_bar';//=> 'FoO_BaR' // Optionally overrides console.log and returns a mOcKiNgCaSe objectmOcKiNgCaSe;console;//=> 'hElLo' const mOcKiNgCaSe = ;console// => 'fOoBaR';// => 'fOoBaR' // Optionally create an initial config with default optionsconst mOcKiNgCaSe = ;// const mOcKiNgCaSe = mOcKiNgCaSe.config({onlyLetters: true, firstUpper: true}); ;//=> 'FoO BaR' ;//=> 'fOo bAr42'
API
- mOcKiNgCaSe(input, [options]) ⇒
string
- mOcKiNgCaSe.overrideString() ⇒
mOcKiNgCaSe
- String.prototype.toMockingCase([options]) ⇒
string
- mOcKiNgCaSe.config(defaultOptions) ⇒
mOcKiNgCaSe
- mOcKiNgCaSe.log(input, [options])
- mOcKiNgCaSe.overrideConsole([options]) ⇒
mOcKiNgCaSe
string
mOcKiNgCaSe(input, [options]) ⇒ Converts the input string(s) to mOcKiNgCaSe.
Kind: global function
Returns: string
- string in mOcKiNgCaSe
Param | Type | Default | Description |
---|---|---|---|
input | string | string[] |
String(s) to be converted | |
[options] | object |
{random: false, onlyLetters: false, firstUpper: false} |
Conversion options |
options.random | boolean |
false |
If case conversion should be randomized |
options.onlyLetters | boolean |
false |
If non letters characters should be removed |
options.firstUpper | boolean |
false |
If the first letter should be capitalized instead of the second when converting to mOcKiNgCaSe (e.g. MoCkInGcAsE). When combined with options.random , the first letter of the random string will be capitalized |
mOcKiNgCaSe
mOcKiNgCaSe.overrideString() ⇒ Creates String.prototype.toMockingCase()
.
Kind: global function
Returns: mOcKiNgCaSe
- The mOcKiNgCaSe module.
See: toMockingCase
string
String.prototype.toMockingCase([options]) ⇒ Converts this
string to mOcKiNgCaSe.
NOTE: this function is created by invoking mOcKiNgCaSe.overrideString()
.
Kind: prototype
Returns: string
- local string in mOcKiNgCaSe
Param | Type | Default | Description |
---|---|---|---|
[options] | object |
{random: false, onlyLetters: false, firstUpper: false} |
Conversion options |
options.random | boolean |
false |
If case conversion should be randomized |
options.onlyLetters | boolean |
false |
If non letters characters should be removed |
options.firstUpper | boolean |
false |
If the first letter should be capitalized instead of the second when converting to mOcKiNgCaSe (e.g. MoCkInGcAsE). When combined with options.random , the first letter of the random string will be capitalized |
mOcKiNgCaSe
mOcKiNgCaSe.config(defaultOptions) ⇒ Outputs a mOcKiNgCaSe with default options.
Kind: static method of mOcKiNgCaSe
Returns: mOcKiNgCaSe with default options
Param | Type | Default | Description |
---|---|---|---|
defaultOptions | object |
Options for converting | |
defaultOptions.random | boolean |
false |
If case conversion should be randomized |
defaultOptions.onlyLetters | boolean |
false |
If non letters characters should be removed |
defaultOptions.firstUpper | boolean |
false |
If the first letter should be capitalized instead of the second when converting to mOcKiNgCaSe (e.g. MoCkInGcAsE). When combined with options.random , the first letter of the random string will be capitalized |
mOcKiNgCaSe.log(input, [options])
Outputs a message to the console in mOcKiNgCaSe.
Kind: static method of mOcKiNgCaSe
Param | Type | Default | Description |
---|---|---|---|
input | string | string[] |
String(S) to be converted | |
[options] | object |
{random: false, onlyLetters: false, firstUpper: false} |
Conversion options |
options.random | boolean |
false |
If case conversion should be randomized |
options.onlyLetters | boolean |
false |
If non letters characters should be removed |
options.firstUpper | boolean |
false |
If the first letter should be capitalized instead of the second when converting to mOcKiNgCaSe (e.g. MoCkInGcAsE). When combined with options.random , the first letter of the random string will be capitalized |
mOcKiNgCaSe
mOcKiNgCaSe.overrideConsole([options]) ⇒ Overrides the console.log input annd prints it in the mOcKiNgCaSe.
Param | Type | Default | Description |
---|---|---|---|
[options] | object |
{random: false, onlyLetters: false, firstUpper: false} |
Conversion options |
options.random | boolean |
false |
If case conversion should be randomized |
options.onlyLetters | boolean |
false |
If non letters characters should be removed |
options.firstUpper | boolean |
false |
If the first letter should be capitalized instead of the second when converting to mOcKiNgCaSe (e.g. MoCkInGcAsE). When combined with options.random , the first letter of the random string will be capitalized |
See also Mockingcase bindings for ReasonML