@ryanlsmith/string_lib v2.1.5
Getting started
To get started, simply go into your project folder and run:
npm i @ryanlsmith/string_lib
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('@ryanlsmith/string_lib')
Table of Contents
firstLetterCap
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.
allFirstUpper
Uppercase every word within the string
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.
removeExtraSpaces
Remove any extra whitespace throughout the string.
Parameters
x
(optional, default''
)
Examples
" this word ".removeExtraWhiteSpace() -> "this word"
Returns String with all the extra white space removed.
snakeCases
Snake case the current string if it has spaces.
Examples
"snake this!".kabobCase() -> "snake_case!"
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