Travis build: 1674

This commit is contained in:
30secondsofcode
2018-02-14 11:32:14 +00:00
parent c132bcd2db
commit b4b0909a1d
8 changed files with 158 additions and 8 deletions

138
README.md
View File

@ -98,6 +98,10 @@ average(1, 2, 3);
<details>
<summary>View contents</summary>
* [`all`](#all)
* [`allBy`](#allby)
* [`any`](#any)
* [`anyBy`](#anyby)
* [`bifurcate`](#bifurcate)
* [`bifurcateBy`](#bifurcateby)
* [`chunk`](#chunk)
@ -136,6 +140,8 @@ average(1, 2, 3);
* [`mapObject`](#mapobject-)
* [`maxN`](#maxn)
* [`minN`](#minn)
* [`none`](#none)
* [`noneBy`](#noneby)
* [`nthElement`](#nthelement)
* [`partition`](#partition)
* [`pull`](#pull)
@ -767,6 +773,94 @@ const unary = fn => val => fn(val);
---
## 📚 Array
### all
Returns `true` if all elements in a collection are truthy, `false` otherwise.
Use `Array.every(Boolean)` to test if all elements in the collection are truthy.
```js
const all = arr => arr.every(Boolean);
```
<details>
<summary>Examples</summary>
```js
all([1, 2, 3]); // true
```
</details>
<br>[⬆ Back to top](#table-of-contents)
### allBy
Returns `true` if the provided predicate function returns `true` for all elements in a collection, `false` otherwise.
Use `Array.every()` to test if all elements in the collection return `true` based on `fn`.
```js
const allBy = (arr, fn) => arr.every(fn);
```
<details>
<summary>Examples</summary>
```js
allBy([4, 2, 3], x => x > 1); // true
```
</details>
<br>[⬆ Back to top](#table-of-contents)
### any
Returns `true` if at least one element in a collection is truthy, `false` otherwise.
Use `Array.some(Boolean)` to test if any elements in the collection are truthy.
```js
const any = arr => arr.some(Boolean);
```
<details>
<summary>Examples</summary>
```js
any([0, 0, 1, 0]); // true
```
</details>
<br>[⬆ Back to top](#table-of-contents)
### anyBy
Returns `true` if the provided predicate function returns `true` for at least one element in a collection, `false` otherwise.
Use `Array.some()` to test if any elements in the collection return `true` based on `fn`.
```js
const anyBy = (arr, fn) => arr.some(fn);
```
<details>
<summary>Examples</summary>
```js
anyBy([0, 1, 2, 0], x => x >= 2); // true
```
</details>
<br>[⬆ Back to top](#table-of-contents)
### bifurcate
Splits values into two groups. If an element in `filter` is truthy, the corresponding element in the collection belongs to the first group; otherwise, it belongs to the second group.
@ -1718,6 +1812,50 @@ minN([1, 2, 3], 2); // [1,2]
<br>[⬆ Back to top](#table-of-contents)
### none
Returns `true` if no elements in a collection are truthy, `false` otherwise.
Use `!Array.some(Boolean)` to test if any elements in the collection are truthy.
```js
const none = arr => !arr.some(Boolean);
```
<details>
<summary>Examples</summary>
```js
none([0, 0, 0]); // true
```
</details>
<br>[⬆ Back to top](#table-of-contents)
### noneBy
Returns `true` if the provided predicate function returns `false` for all elements in a collection, `false` otherwise.
Use `Array.some()` to test if any elements in the collection return `true` based on `fn`.
```js
const noneBy = (arr, fn) => !arr.some(fn);
```
<details>
<summary>Examples</summary>
```js
noneBy([0, 1, 3, 0], x => x == 2); // true
```
</details>
<br>[⬆ Back to top](#table-of-contents)
### nthElement
Returns the nth element of an array.

File diff suppressed because one or more lines are too long

View File

@ -9,5 +9,5 @@ const all = arr => arr.every(Boolean);
```
```js
all([1,2,3]); // true
all([1, 2, 3]); // true
```

View File

@ -9,5 +9,5 @@ const allBy = (arr, fn) => arr.every(fn);
```
```js
allBy([4,2,3], x => x > 1); // true
allBy([4, 2, 3], x => x > 1); // true
```

View File

@ -9,5 +9,5 @@ const any = arr => arr.some(Boolean);
```
```js
any([0,0,1,0]); // true
any([0, 0, 1, 0]); // true
```

View File

@ -9,5 +9,5 @@ const anyBy = (arr, fn) => arr.some(fn);
```
```js
anyBy([0,1,2,0], x => x >= 2); // true
anyBy([0, 1, 2, 0], x => x >= 2); // true
```

View File

@ -9,5 +9,5 @@ const none = arr => !arr.some(Boolean);
```
```js
none([0,0,0]); // true
none([0, 0, 0]); // true
```

View File

@ -9,5 +9,5 @@ const noneBy = (arr, fn) => !arr.some(fn);
```
```js
noneBy([0,1,3,0], x => x == 2); // true
noneBy([0, 1, 3, 0], x => x == 2); // true
```