Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@jewarner57/easy-as-string

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jewarner57/easy-as-string

A String Manipulation Helper Library

  • 1.1.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

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

Keywords

FAQs

Package last updated on 13 Apr 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc