Travis build: 765 [ci skip]

This commit is contained in:
Travis CI
2018-01-01 12:38:25 +00:00
parent b0e441635a
commit cd0fdb7741
4 changed files with 48 additions and 6 deletions

View File

@ -272,6 +272,7 @@
<details>
<summary>View contents</summary>
* [`join`](#join)
* [`sortedIndex`](#sortedindex)
</details>
@ -4589,6 +4590,35 @@ yesNo('Foo', true); // true
---
## _Uncategorized_
### join
Joins all elements of an array into a string and returns this string. Uses a separator and an end separator.
Use `Array.reduce()` to combine elements into a string.
Omit the second argument, `separator`, to use a default separator of `','`.
Omit the third argument, `end`, to use the same value as `separator` by default.
```js
const join = (arr, separator = ',', end = separator) =>
arr.reduce(
(acc, val, i) =>
i == arr.length - 2
? acc + val + end
: i == arr.length - 1 ? acc + val : acc + val + separator,
''
);
```
```js
join(); // ''
join(['pen', 'pineapple', 'apple', 'pen'], ',', '&'); //"pen,pineapple,apple&pen"
join(['pen', 'pineapple', 'apple', 'pen'], ','); //"pen,pineapple,apple,pen"
join(['pen', 'pineapple', 'apple', 'pen']); //"pen,pineapple,apple,pen"
```
<br>[⬆ back to top](#table-of-contents)
### sortedIndex
Returns the lowest index at which value should be inserted into array in order to maintain its sort order.

File diff suppressed because one or more lines are too long

View File

@ -15,12 +15,11 @@ const join = (arr, separator = ',', end = separator) =>
: i == arr.length - 1 ? acc + val : acc + val + separator,
''
);
```
```js
join(); // ''
join(['pen','pineapple','apple','pen'],',','&'); //"pen,pineapple,apple&pen"
join(['pen','pineapple','apple','pen'],','); //"pen,pineapple,apple,pen"
join(['pen','pineapple','apple','pen']); //"pen,pineapple,apple,pen"
join(['pen', 'pineapple', 'apple', 'pen'], ',', '&'); //"pen,pineapple,apple&pen"
join(['pen', 'pineapple', 'apple', 'pen'], ','); //"pen,pineapple,apple,pen"
join(['pen', 'pineapple', 'apple', 'pen']); //"pen,pineapple,apple,pen"
```

View File

@ -81,6 +81,7 @@ isPromiseLike:utility
isString:utility
isSymbol:utility
isValidJSON:utility
join:uncategorized
JSONToDate:date
JSONToFile:node
last:array