
Security News
npm Adopts OIDC for Trusted Publishing in CI/CD Workflows
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
mockingcase
Advanced tools
Convert a string to mOcKiNgCaSe.
Read more on wikipedia Studly caps.
Inspired by the meme Mocking Spongebob and http://dannypage.github.io/spongebob.html
$ npm install mockingcase --save
const mOcKiNgCaSe = require('mockingcase');
// es6 - import mOcKiNgCaSe from 'mockingcase';
// ts - import * as mOcKiNgCaSe from 'mockingcase';
// ts - import mOcKiNgCaSe = require('mockingcase');
mOcKiNgCaSe('foo-bar');
//=> 'fOo-bAr'
mOcKiNgCaSe('aa', {random: false});
//=> 'aA'
mOcKiNgCaSe('aa', {random: true});
//=> 'aa'
//=> 'aA'
//=> 'Aa'
//=> 'AA'
mOcKiNgCaSe('42foo!bar');
//=> '42fOo!bAr'
mOcKiNgCaSe('aa123', {onlyLetters: true});
//=> 'aA'
mOcKiNgCaSe('a13%$a', {onlyLetters: true});
//=> 'aA'
mOcKiNgCaSe('foo bar', {firstUpper: true});
//=> 'FoO BaR'
mOcKiNgCaSe('foo', {firstUpper: true, random: true});
//=> 'Foo'
//=> 'FOo'
//=> 'FoO'
//=> 'FOO'
mOcKiNgCaSe(['foo','bar']);
//=> 'fOoBaR'
mOcKiNgCaSe(undefined);
//=> Error "An input is required"
mOcKiNgCaSe.log('foo bar');
// console.log('fOo bAr');
// Optionally create String.prototype.toMockingCase
mOcKiNgCaSe.overrideString();
'foo_bar'.toMockingCase();
//=> 'fOo_bAr'
'foo_bar'.toMockingCase({firstUpper: true});
//=> 'FoO_BaR'
// Optionally overrides console.log and returns a mOcKiNgCaSe object
mOcKiNgCaSe.overrideConsole();
console.log('Hello');
//=> 'hElLo'
const mOcKiNgCaSe = require('mockingcase').overrideConsole();
console.log('foobar')
// => 'fOoBaR'
mOcKiNgCaSe('foobar');
// => 'fOoBaR'
// Optionally create an initial config with default options
const mOcKiNgCaSe = require('mockingcase').config({onlyLetters: true, firstUpper: true});
// const mOcKiNgCaSe = mOcKiNgCaSe.config({onlyLetters: true, firstUpper: true});
mOcKiNgCaSe('foo bar42');
//=> 'FoO BaR'
mOcKiNgCaSe('foo bar42', {onlyLetters: false, firstUpper: false});
//=> 'fOo bAr42'
string
mOcKiNgCaSe
string
mOcKiNgCaSe
mOcKiNgCaSe
string
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
Creates String.prototype.toMockingCase()
.
Kind: global function
Returns: mOcKiNgCaSe
- The mOcKiNgCaSe module.
See: toMockingCase
string
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
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 |
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
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
FAQs
Convert a string to mOcKiNgCaSe
We found that mockingcase demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.