Methods
camelCase(value) → {string}
- Description:
- Returns a camelCased version of a string separated by dash/dot/underscore/space.
- Source:
Example
camelCase("hello_world")
// will result in helloWorld
Parameters:
Name |
Type |
Description |
value |
string
|
Value to convert. |
Returns:
-
Type
-
string
convert(value, options=opt) → {string}
- Description:
- Converts a string to a certain encoding.
- Source:
Example
convert("hello world", "utf-8", "hex")
// will result in 68656c6c6f20776f726c64
Parameters:
Name |
Type |
Attributes |
Description |
value |
string
|
|
Value to convert. |
options= |
Object
|
<optional>
|
Optional options. |
options.from= |
BufferEncoding
|
<optional>
|
Buffer encoding to convert **from**. |
options.to= |
string
|
<optional>
|
Buffer encoding to convert **to**. |
Returns:
-
Type
-
string
count(value, pattern) → {number}
- Description:
- Finds the amount of times a Regex Pattern or a string.
- Source:
Example
count("hello world", "o")
// will result in 2
Parameters:
Name |
Type |
Description |
value |
string
|
Value to search. |
pattern |
string
|
RegExp
|
The regex or string to count the amount of. |
Returns:
-
Type
-
number
isString(value) → {boolean}
- Description:
- Returns whether or not a value is a string.
- Source:
Example
isString(4);
// returns false.
Parameters:
Name |
Type |
Description |
value |
any
|
Value to check. |
Returns:
-
Type
-
boolean
kebabCase(value) → {string}
- Description:
- Returns a kebab-cased version of a string separated by dash/dot/underscore/space.
- Source:
Example
kebabCase("Hello World")
// will result in hello-world
Parameters:
Name |
Type |
Description |
value |
string
|
Value to convert. |
Returns:
-
Type
-
string
pascalCase(value) → {string}
- Description:
- Returns a PascalCased version of a string separated by dash/dot/underscore/space.
- Source:
Example
pascalCase("hello_world")
// will result in HelloWorld
Parameters:
Name |
Type |
Description |
value |
string
|
Value to convert. |
Returns:
-
Type
-
string
reverse(value) → {string}
- Description:
- Source:
Example
reverse("Hello World")
// will result in dlroW olleH
Parameters:
Name |
Type |
Description |
value |
string
|
Value to convert. |
Returns:
-
Type
-
string
snakeCase(value) → {string}
- Description:
- Returns a snake_cased version of a string separated by dash/dot/underscore/space.
- Source:
Example
snakeCase("hello World")
// will result in hello_world
Parameters:
Name |
Type |
Description |
value |
string
|
Value to convert. |
Returns:
-
Type
-
string
space(value) → {string}
- Description:
- Replaces any non numeric, or non alphabetic character with a space.
- Source:
Example
space("Hello_world")
// will result in "Hello world"
Parameters:
Name |
Type |
Description |
value |
string
|
Value to convert. |
Returns:
-
Type
-
string
swapCase(value) → {string}
- Description:
- Converts a string's uppercase characters to lowercase and vice versa.
- Source:
Example
swapCase("Hello World")
// will result in hELLO wORLD
Parameters:
Name |
Type |
Description |
value |
string
|
Value to convert. |
Returns:
-
Type
-
string
title(value) → {string}
- Description:
- Capitalizes every first character of a word.
- Source:
Example
title("hello world")
// will result in "Hello world"
Parameters:
Name |
Type |
Description |
value |
string
|
Value to convert. |
Returns:
-
Type
-
string