streng

1.0.0 • Public • Published

streng

Some helpful utility functions for handling strings & object keys

Methods

Note: All methods force stringiness on the value passed as str.

  • toSentenceCase(str, index): Capitalize the first letter of the first word.
  • toUpperCase(str): Convert to all capitals
  • toLowerCase(str): Convert to all lowercase
  • toTitleCase(str): Capitalize the first letter of each word
  • toSnakeCase(str): Replaces spaces with "_"
  • snakeToCamel(str): Converts from snakecase to camelcase
  • camelToSnake(str): Converts from camelcase to snakecase
  • snakeObjectToCamelObject(obj): Converts object keys from snakecase to camelcase
  • camelObjectToSnakeObject(obj): Converts object keys from camelcase to snakecase
  • shortenWithCenterEllipsis(str, length): splits any string longer than the provided length with an ellipsis
  • toListFromArray(arr): returns a string version of an array
  • splitTimeString(str): provides the hours and minutes in a time string

Package Sidebar

Install

npm i streng

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

257 kB

Total Files

9

Last publish

Collaborators

  • seancdinan