0.1.1 • Published 6 years ago
cool-text-package v0.1.1
check it out on npm!
Features
String.prototype.upperFirst( )A function that uppercases the first character of string.- Example Input:
i want this capitalized. - Expected Output:
I want this capitalized.
- Example Input:
String.prototype.lowerFirst( )A function that lowercases the first character of string.- Example Input:
I like lowercase - Expected Output:
i like lowercase
- Example Input:
String.prototype.upperWord( )A function that uppercases the first letter of each word in a string.- Example Input:
I like caps. - Expected Output:
I Like Caps.
- Example Input:
String.prototype.upperWiggle( )A function that uppercases every other letter.- Example Input:
I feel All wiggly. - Expected Output:
I FeEl aLl wIgGlY.
- Example Input:
String.prototype.removeSpaces( )A function that removes all whitespace from a given string.- Example Input:
try to decode this! - Expected Output:
trytodecodethis!
- Example Input:
String.prototype.trimSpaces( )A function that removes only the extra whitespace from a given string (example:“ a b ” → “a b”).- Example Input:
far out - Expected Output:
far out
- Example Input:
String.prototype.allCaps( )A function that makes all characters uppercase. (this is the same as.toUppercase()).- Example Input:
i like to yell!! - Expected Output:
I LIKE TO YELL!!
- Example Input:
String.prototype.kababCase( )A function that removes extra spaces and replaces spaces with the hyphen "-", and makes all characters lowercase.- Example Input:
What is kabab-case anyway - Expected Output:
what-is-kabab-case-anyway
- Example Input:
String.prototype.snakeCase( )Removes extra space and replaces spaces with an underscore "_", and makes all characters lowercase.- Example Input:
Snakes are Amazing - Expected Output:
snakes_are_amazing
- Example Input:
String.prototype.camelCase( )Lowercases the first character of the first word. Then uppercases the first character of all other words, and removes all spaces.- Example Input:
CAMELS are a special sort of animal. - Expected Output:
camelsAreASpecialSortOfAnimal
- Example Input:
See Homework 1
Usage
Just connect any of those functions to a string and see magic! Note, none of these functions take in a parameter. They are methods.
Example:
let superString =
'wow! this project is soooooooooooo cool. Just amazing. '
console.log(superString.snakeCase())