util-string

Methods

(inner) camelCase(str) → {string}

Takes a string having hyphens and convert to camelCase
Parameters:
Name Type Description
str string
Since:
  • 0.0.2
Source:
Example
// returns helloWorld
camelCase('hello-world');
// returns abcd
camelCase('abcd');
// returns helloMrWorld
camelCase('hello-mr-world');

(inner) fixEs6LiteralSpacing(str, replaceWith) → {string}

Takes ES6 literal string having new lines and trim new line spaces which comes before the line when indented
Parameters:
Name Type Default Description
str string
replaceWith string when newlines are encountered and spaces are trimmed, this param acts as a join the newline splitted text with
Since:
  • 0.0.2
Source:
Example
// returns heytherewith spacestrimmed off
fixEs6LiteralSpacing(`hey
there
  with spaces
     trimmed off
`, '');

(inner) lower(str) → {string}

Takes a string and convert it into lowercase
Parameters:
Name Type Description
str string
Since:
  • 0.0.2
Source:
Example
// returns abc
lower('aBc');
// returns abcdefg
lower('ABCDefG');

(inner) upper(str) → {string}

Takes a string and convert it into uppercase
Parameters:
Name Type Description
str string
Since:
  • 0.0.2
Source:
Example
// returns ABC
upper('aBc');
// returns ABCDEFG
upper('abcdEFg');