README
String library extension
This project is a lightweight library that extends
the functionality of javascripts built in String
type with some functions that
may come in handy.
Getting started
To get started, simply go into your project folder and run:
npm install @cenz/string-lib --save
This will install the string library into your application. To get access to the extended
functionallity that is provided by this library, add this to your index.js
or whatever you're
using as your applications main point of entry:
require('@cenz/string-lib')
API Table of Contents
- capitalize
- allCaps
- capitalizeWords
- oddCaps
- evenCaps
- removeExtraWhiteSpace
- kabobCase
- snakeCase
- camelCase
capitalize
Capitalize the first letter of the current string.
Examples
"this".capitalize() -> "This"
Returns String The capitalized version of the current string.
allCaps
Uppercase every character within the string.
Examples
"this".allCaps() -> "THIS"
Returns String The entire string all capitalized of the current string.
capitalizeWords
Uppercase every word within the string (Not including: the, in, a, an, and, but, for, at, by, from)
Examples
"this word".capitalizeWords() -> "This Word"
Returns String with every first character in every word capitalized of the current string.
oddCaps
Uppercase every other odd character not including white space.
Examples
"this".oddCaps() -> "tHiS"
Returns String of every odd character capitalized of the current string.
evenCaps
Uppercase every even character not including white space.
Examples
"this".evenCaps() -> "ThIs"
Returns String of every even character capitalized of the current string.
removeExtraWhiteSpace
Remove any extra whitespace throughout the string.
Examples
" this word ".removeExtraWhiteSpace() -> "this word"
Returns String with all the extra white space removed.
kabobCase
Kabob case the current string if it has spaces.
Examples
"kabob this!".kabobCase() -> "kabob-this!"
Returns String that is a kabob cased version of the current string
snakeCase
Snake case the current string if it has spaces.
Examples
"snake case this!".snakeCase() -> "snake_case_this!"
Returns String that is a snake cased version of the current string
camelCase
Convert the current string to camel case if it has spaces.
Examples
"camel case these words!".camelCase() -> "camelCaseTheseWords"
Returns String that is a camel cased version of the current string