Travis build: 773 [ci skip]

This commit is contained in:
Travis CI
2018-01-01 12:54:01 +00:00
parent 971b58aef6
commit ea2dfde1bf
3 changed files with 40 additions and 42 deletions

View File

@ -68,6 +68,7 @@
* [`sampleSize`](#samplesize)
* [`shuffle`](#shuffle)
* [`similarity`](#similarity)
* [`sortedIndex`](#sortedindex)
* [`symmetricDifference`](#symmetricdifference)
* [`tail`](#tail)
* [`take`](#take)
@ -269,15 +270,6 @@
</details>
### _Uncategorized_
<details>
<summary>View contents</summary>
* [`sortedIndex`](#sortedindex)
</details>
---
## 🔌 Adapter
@ -1327,6 +1319,34 @@ similarity([1, 2, 3], [1, 2, 4]); // [1,2]
<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.
Check if the array is sorted in descending order (loosely).
Use `Array.findIndex()` to find the appropriate index where the element should be inserted.
```js
const sortedIndex = (arr, n) => {
const isDescending = arr[0] > arr[arr.length - 1];
const index = arr.findIndex(el => (isDescending ? n >= el : n <= el));
return index === -1 ? arr.length : index;
};
```
<details>
<summary>Examples</summary>
```js
sortedIndex([5, 3, 2, 1], 4); // 1
sortedIndex([30, 50], 40); // 1
```
</details>
<br>[⬆ Back to top](#table-of-contents)
### symmetricDifference
Returns the symmetric difference between two arrays.
@ -4190,6 +4210,7 @@ Use the spread operator (`...`) to check if the provided argument is iterable in
```js
const isArrayLike = val =>
try {return [...val], true; }
catch (e) { return false; }
@ -4650,31 +4671,6 @@ yesNo('Foo', true); // true
<br>[⬆ Back to top](#table-of-contents)
---
## _Uncategorized_
### sortedIndex
Returns the lowest index at which value should be inserted into array in order to maintain its sort order.
Check if the array is sorted in descending order (loosely).
Use `Array.findIndex()` to find the appropriate index where the element should be inserted.
```js
const sortedIndex = (arr, n) => {
const isDescending = arr[0] > arr[arr.length - 1];
const index = arr.findIndex(el => (isDescending ? n >= el : n <= el));
return index === -1 ? arr.length : index;
};
```
```js
sortedIndex([5, 3, 2, 1], 4); // 1
sortedIndex([30, 50], 40); // 1
```
<br>[⬆ back to top](#table-of-contents)
## Collaborators

File diff suppressed because one or more lines are too long

View File

@ -6,6 +6,7 @@ Use the spread operator (`...`) to check if the provided argument is iterable in
```js
const isArrayLike = val =>
try {return [...val], true; }
catch (e) { return false; }