1.1.2 • Published 3 years ago

@jewarner57/easy-as-string v1.1.2

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

npm (scoped) GitHub last commit GitHub top language

easy-as-string Library

I laugh in the face of complicated string problems. With this library, you can too.

Installation

  • You can install this string library here via npm

Usage

  • Below you will find the functions included in this library and how to use them.

String.prototype.capitalize()

  • Capitalizes the first letter of a string.
"capitalize me".capitalize() -> "Capitalize me"

String.prototype.upper()

  • Capitalizes all characters in a string.
"upper me".upper() -> "UPPER ME"

String.prototype.capitalizeWords()

  • Capitalizes all words in a string.
"capitalize my words".capitalizeWords() -> "Capitalize My Words"

String.prototype.capitalizeHeadline()

  • Capitalizes all words in a string except: "the", "in", "a", "an", "and", "but", "for", "at", "by", "from"
  • Always capitalizes the first word of the string.
"a headline from a publication".capitalizeHeadline() -> "A Headline from a Publication"

String.prototype.removeExtraSpaces()

  • Removes all types of white space. If two words have more than one white space character between them, a single space is left there.
"\n\n\n\n Destroy \t\t\t\r\rAll      Whitespace \n \t \r ".removeExtraSpaces() -> "Destroy All Whitespace"

String.prototype.kebabCase()

  • Lowercases string, removes extra spaces, and replaces spaces with "-"
"mAkE \n mE A   KeBaB  ".kebabCase() -> "make-me-a-kebab"

String.prototype.snakeCase()

  • Lowercases string, removes extra spaces, and replaces spaces with "_"
"mAkE \n mE A   sNaKE  ".snakeCase() -> "make_me_a_snake"

String.prototype.camelCase()

  • Removes all spaces, capitalizes each word except the first.
"MAKE thiS Camel case".camelCase() -> "makeThisCamelCase"

String.prototype.shift()

  • Shifts the first letter of the string to the end of the word.
"Hello World".shift() -> "elloWorldH"

String.prototype.makeHashTag()

  • Returns an array of the 3 longest words preceded by a hashtag.
"there was a potato and a beachball and a forest ".makeHashTag() -> ["#potato", "#beachball", "#forest"]

String.prototype.isEmpty()

  • Returns true if the given string contains only whitespace.
"\n\n\n   \t\t \r\r".isEmpty() -> true
"Some characters".isEmpty() -> false
1.1.2

3 years ago

1.1.0

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.0

3 years ago