string

Contains functions for strings.

Methods

static camelCase(xs, patternopt) → {string}

Camel cases (class case) a string.
Parameters:
Name Type Attributes Default Description
xs String
pattern RegExp <optional>
/[^a-z\d/i]/ Pattern to split on. Optional.
Throws:
- Throws error if param `xs` is not a string.
Type
Error
Returns:
string

static classCase(xs) → {string}

Class cases a string. Uses pattern /[^a-z\d/i]/ to split on. If you require a different pattern use `string.camelCase(str, pattern)` and then upper case first character (`ucaseFirst`).
Parameters:
Name Type Description
xs String
Throws:
- Throws error if `xs` is not a string (via `camelCase` call).
Type
Error
Returns:
string

static lcaseFirst(xs) → {string}

Lower cases first character of a non-empty string.
Parameters:
Name Type Description
xs String
Throws:
- Throws error if receiving anything that is not a string.
Type
Error
Returns:
string

static lines(str) → {Array}

Splits a string on all '\n', '\r', '\n\r', or '\r\n' characters.
Parameters:
Name Type Description
str String
Returns:
Array

static split(separator, str) → {Array}

Functional version of `String.prototype.split`.
Parameters:
Name Type Description
separator String | RegExp
str String
Returns:
Array

static ucaseFirst(xs) → {string}

Upper cases first character of a non-empty string.
Parameters:
Name Type Description
xs String
Throws:
- Throws error if receiving anything that is not a string.
Type
Error
Returns:
string

static unlines(list) → {Array}

Intersperses a '\n' character into a list of strings and then concats it.
Parameters:
Name Type Description
list Array | String | *
Returns:
Array

static unwords(arr) → {Array}

Intersperse an array of strings with '\s' and then concats them.
Parameters:
Name Type Description
arr String
Returns:
Array

static words(str) → {Array}

Splits a string on all '\s' and/or all '\t' characters.
Parameters:
Name Type Description
str String
Returns:
Array