Methods
(static) to_array(ObjectWithLengthopt) → {Array}
- Source:
- Since:
- 0.1.0
Creates a real Array from the list (anything that can be iterated over). Useful for transmuting the arguments object.
Example
function convertArguments() {
return to_array(arguments);
}
to_array({0: 10, 1: 20, length: 2}) // => [10, 20]
to_array("word") // => ["w", "o", "r", "d"]
to_array(takeArguments(1, 2, 3)); // => [1, 2, 3]
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
ObjectWithLength |
* |
<optional> |
An object that has length property. |
Returns:
Array containing all values from an ObjectWithLength.
- Type
- Array
(static) to_boolean(value) → {Boolean}
- Source:
- Since:
- 0.1.0
A function that converts truthy value into boolean true
and falsy into boolean false
.
Example
to_boolean({}); // => true
to_boolean([]); // => true
to_boolean("Hello"); // => true
to_boolean(""); // => false
to_boolean(null); // => false
to_boolean(0); // => false
to_boolean(1); // => true
Parameters:
Name | Type | Description |
---|---|---|
value |
* | Value to convert. |
Returns:
Boolean representation of a provided value.
- Type
- Boolean
(static) to_lower(str) → {String}
- Source:
- Since:
- 0.1.0
Returns a string equal in length to the length of the result of converting this object to a string. The result is a string value, not a String object.
Example
to_lower('ABC'); //=> 'abc'
Parameters:
Name | Type | Description |
---|---|---|
str |
String | String to transform. |
Returns:
Lowercased string.
- Type
- String
(static) to_string(value) → {String}
- Source:
- Since:
- 0.1.0
A function that converts any value in their representative string.
Example
to_string([1, 2, 3]); // => "[1,2,3]"
to_string({}); // => "{}"
to_string(123); // => "123"
Parameters:
Name | Type | Description |
---|---|---|
value |
* | Value to convert. |
Returns:
Converted string.
- Type
- String
(static) to_stringCapitalized(value) → {String}
- Source:
- Since:
- 0.1.0
Return received string with first letter in uppercase.
Example
to_stringCapitalized('abc'); // => 'Abc'
Parameters:
Name | Type | Description |
---|---|---|
value |
String |
Returns:
- Type
- String
(static) to_upper(str) → {String}
- Source:
- Since:
- 0.1.0
Returns a string equal in length to the length of the result of converting this object to a string. The result is a string value, not a String object.
Example
to_upper('abc'); // => 'ABC'
Parameters:
Name | Type | Description |
---|---|---|
str |
String | String to transform. |
Returns:
Uppercased string.
- Type
- String