All Projects → strdr4605 → Mockingcase

strdr4605 / Mockingcase

Licence: isc
node package that converts a string to mOcKiNgCaSe

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Mockingcase

Artisan View
👀 Manage your views in Laravel projects through artisan
Stars: ✭ 708 (+856.76%)
Mutual labels:  hacktoberfest, package
Gub
CLI tool for create an npm package from any repos. 🐳
Stars: ✭ 31 (-58.11%)
Mutual labels:  package, npm
Snm
🤏 Smol Node Manager written in Rust
Stars: ✭ 24 (-67.57%)
Mutual labels:  package, npm
Laravel Translatable
A Laravel package for multilingual models
Stars: ✭ 624 (+743.24%)
Mutual labels:  hacktoberfest, package
React Native Markdown Editor
A markdown editor like github comment editor (contains preview, helper buttons)
Stars: ✭ 59 (-20.27%)
Mutual labels:  package, npm
Oji
(◕‿◕) Text Emoticons Maker
Stars: ✭ 668 (+802.7%)
Mutual labels:  package, npm
Sao Nm
Scaffold out a node module.
Stars: ✭ 30 (-59.46%)
Mutual labels:  package, npm
Vanilla Framework
From community websites to web applications, this CSS framework will help you achieve a consistent look and feel.
Stars: ✭ 476 (+543.24%)
Mutual labels:  package, npm
Laravel Packager
A cli tool for creating Laravel packages
Stars: ✭ 1,049 (+1317.57%)
Mutual labels:  hacktoberfest, package
Npm Git Install
Clones and (re)installs packages from remote git repos. See npm/npm#3055
Stars: ✭ 49 (-33.78%)
Mutual labels:  package, npm
Lass
👧 Lass scaffolds a modern package boilerplate for Node.js
Stars: ✭ 615 (+731.08%)
Mutual labels:  package, npm
Npmf
Fetch quick info of a npm pacakge using terminal
Stars: ✭ 64 (-13.51%)
Mutual labels:  package, npm
Angular Auth Oidc Client
npm package for OpenID Connect, OAuth Code Flow with PKCE, Refresh tokens, Implicit Flow
Stars: ✭ 577 (+679.73%)
Mutual labels:  hacktoberfest, npm
Lerna
Splitting up large codebases into separate independently versioned packages is extremely useful for code sharing. However, making changes across many repositories is messy and difficult to track, and testing across repositories becomes complicated very quickly.
Stars: ✭ 31,079 (+41898.65%)
Mutual labels:  package, npm
Ultra Runner
🏃⛰ Ultra fast monorepo script runner and build tool
Stars: ✭ 496 (+570.27%)
Mutual labels:  hacktoberfest, npm
Typac
install npm packages along with corresponding typings
Stars: ✭ 29 (-60.81%)
Mutual labels:  package, npm
Strongbox
Strongbox is an artifact repository manager.
Stars: ✭ 412 (+456.76%)
Mutual labels:  hacktoberfest, npm
Npkill
List any node_modules directories in your system, as well as the space they take up. You can then select which ones you want to erase to free up space.
Stars: ✭ 5,325 (+7095.95%)
Mutual labels:  hacktoberfest, npm
Nasa Cli
🚀 Download NASA Picture of the Day from your terminal!
Stars: ✭ 45 (-39.19%)
Mutual labels:  package, npm
Packagephobia
⚖️ Find the cost of adding a new dependency to your project
Stars: ✭ 1,110 (+1400%)
Mutual labels:  hacktoberfest, npm

mockingcase Build Status Hits-of-Code HitCount

Convert a string to mOcKiNgCaSe.

Read more on wikipedia Studly caps.

mocking spongebob

Inspired by the meme Mocking Spongebob and http://dannypage.github.io/spongebob.html

Install

npm install @strdr4605/mockingcase --save

Usage

const mockingcase = require('@strdr4605/mockingcase');
// es6 - import mockingcase from '@strdr4605/mockingcase';
//  ts - import * as mockingcase from '@strdr4605/mockingcase';
//  ts - import mockingcase = require('@strdr4605/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('abcdef', {upper: /[bdf]/});
//=> 'aBcDeF'

mockingcase('ABCDEF', {lower: 'bcd'});
//=> 'abcdeF'

API

Functions

mockingcase(input, [options])string

Converts the input string(s) to mOcKiNgCaSe.

Typedefs

Options : Object

Options for mockingcase

mockingcase(input, [options]) ⇒ string ⬆️

Converts the input string(s) to mOcKiNgCaSe.

Kind: global function Returns: string - string in mOcKiNgCaSe

Param Type Default Description
input string | Array.<string> String(s) to be converted.
[options] Options {random: false, onlyLetters: false, firstUpper: false, upper: '', lower: ''} Conversion options.
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 bar', {firstUpper: true, lower: /[fb]/});
//=> 'foO baR'

mockingcase('foo bar', {firstUpper: true, upper: /[oa]/});
//=> 'FOO BAR'

mockingcase('foo', {firstUpper: true, random: true});
//=> 'Foo'
//=> 'FOo'
//=> 'FoO'
//=> 'FOO'

mockingcase(['foo','bar']);
//=> 'fOoBaR'

mockingcase(undefined);
//=> Error "An input is required"

mockingcase.overrideString() ⇒ mockingcase ⬆️

Creates String.prototype.toMockingCase().

Kind: static method of mockingcase
Returns: mockingcase

mockingcase.overrideString();

'foo_bar'.toMockingCase();
//=> 'fOo_bAr'

'foo_bar'.toMockingCase({firstUpper: true});
//=> 'FoO_BaR'

String.prototype.toMockingCase([options]) ⇒ 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
input string | Array.<string> String(S) to be converted.
[options] Options {random: false, onlyLetters: false, firstUpper: false, upper: '', lower: ''} Conversion options.
'foo_bar'.toMockingCase();
//=> 'fOo_bAr'

'foo_bar'.toMockingCase({firstUpper: true});
//=> 'FoO_BaR'

mockingcase.config(defaultOptions) ⇒ mockingcase ⬆️

Outputs a mockingcase with default options.

Kind: static method of mockingcase
Returns: mockingcase with default options

Param Type Default Description
defaultOptions Options {random: false, onlyLetters: false, firstUpper: false, upper: '', lower: ''} Conversion options.
const mockingcase = require('@strdr4605/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'

mockingcase.log(input, [options]) ⬆️

Outputs a message to the console in mOcKiNgCaSe.

Kind: static method of mockingcase

Param Type Default Description
input string | Array.<string> String(S) to be converted.
[options] Options {random: false, onlyLetters: false, firstUpper: false, upper: '', lower: ''} Conversion options.
mockingcase.log('foo bar');
// console.log('fOo bAr');


mockingcase.overrideConsole([options]) ⇒ mockingcase ⬆️

Overrides console.log input to print the input mOcKiNgCaSe.

Kind: static method of mockingcase
Returns: function - mockingcase function
See: mockingcase

Param Type Default Description
[options] Options {random: false, onlyLetters: false, firstUpper: false, upper: '', lower: ''} Conversion options.
const mockingcase = require('@strdr4605/mockingcase').overrideConsole();
console.log('foobar')
// => 'fOoBaR'
mockingcase('foobar');
// => 'fOoBaR'

Options : Object ⬆️

Options for mockingcase

Kind: global typedef
Properties

Name Type Default Description
[random] boolean false If case conversion should be randomized.
[onlyLetters] boolean false If non letters characters should be removed.
[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.
[upper] string | RegExp '' Characters or substring set to change to uppercase, upper has higher priority that lower.
[lower] string | RegExp '' Characters or substring set to change to lowercase.

Browser Usage ⬆️

mOcKiNgCaSe can be used in a node environment, as well as in the browser. You can serve it yourself, or pull it from a CDN. For example:

<!DOCTYPE html>
<html lang="en">
<head>
  <title>mockingcase</title>
</head>
<body>
</body>
<script src="https://unpkg.com/@strdr4605/[email protected]/src/mockingcase.js"></script>
<script>
  const output = mockingcase('foo-bar');
  console.log(output);
  const output2 = mockingcase('foo-bar');
  console.log(output2);
</script>
</html>

Self Hosting

To host mockingcase yourself simply put src/mockingcase.js wherever your static content (like CSS stylesheets) are kept. You can also download a minified file from one of the CDNs below.

CDN Usage

Simply pull in one of the following JS files below.

Name Link
unpkg.com https://unpkg.com/@strdr4605/mockingcase
JSDelivr.com https://cdn.jsdelivr.net/npm/@strdr4605/mockingcase

See also Mockingcase bindings for ReasonML

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].