Constructor
new RichString()
Prefer fromString
- Source:
Example
const string = RichString.fromString(element.textContent)
element.textContent = string.humanize().toString()
Methods
camelize()
Returns a RichString
with the string converted from snake or kebab case into camel case.
- Source:
capitalize()
Returns a RichString
with the string capitalized.
- Source:
decamlize(parameters)
Returns a RichString
with the string converted from camel case to snake or kebab case.
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
parameters |
Object |
Properties
|
- Source:
decapitalize()
Returns a RichString
with the string un-capitalized.
- Source:
humanize()
Returns a 'humanized' RichString
, which is basically a de-camelized version with the first letter
capitalized.
- Source:
toString()
Return the underlying String value
- Source:
toStringOrNull()
Return the underlying String value or null if the string is blank
- Source:
(static) fromString(possiblyDefinedStringOrRichString)
Prefer this over the constructor, as this will
wrap possiblyDefinedStringOrRichString
only if necessary
as well as handle null
.
Parameters:
Name | Type | Description |
---|---|---|
possiblyDefinedStringOrRichString |
null | undefined | String | RichString | if |
- Source: