Methods
(static) join(array, separatoropt) → {String}
- Source:
- Since:
- 0.1.0
Converts all elements in array into a string separated by separator.
Example
_.join(['a', 'b', 'c'],' | ')
// => 'a | b | c'
_.join(['a', 'b', 'c'], '~');
// => 'a~b~c'
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
array |
Array | The array to convert. | ||
separator |
String |
<optional> |
','
|
The element separator. |
Returns:
Returns the joined string.
- Type
- String
(static) reverse(array) → {Array}
- Source:
- Since:
- 0.1.0
Reverses array so that the first element becomes the last, the second element becomes the second to last, and so on.
Example
var array = [1, 2, 3];
_.reverse(array);
// => [3, 2, 1]
console.log(array);
// => [3, 2, 1]
Parameters:
Name | Type | Description |
---|---|---|
array |
Array | The array to modify. |
Returns:
Returns array.
- Type
- Array
(static) tail(array) → {Array}
- Source:
- Since:
- 0.1.0
Gets all but the first element of array.
Example
_.tail([1, 2, 3]);
// => [2, 3]
Parameters:
Name | Type | Description |
---|---|---|
array |
Array | The array to query. |
Returns:
Returns the slice of array.
- Type
- Array