Travis build: 1265

This commit is contained in:
30secondsofcode
2018-01-16 15:14:29 +00:00
parent dd5f7c8c3e
commit 62bb691a8b
3 changed files with 95 additions and 4 deletions

View File

@ -112,6 +112,7 @@ average(1, 2, 3);
* [`initial`](#initial)
* [`initialize2DArray`](#initialize2darray)
* [`initializeArrayWithRange`](#initializearraywithrange)
* [`initializeArrayWithRangeRight`](#initializearraywithrangeright)
* [`initializeArrayWithValues`](#initializearraywithvalues)
* [`intersection`](#intersection)
* [`isSorted`](#issorted)
@ -329,6 +330,7 @@ average(1, 2, 3);
* [`isBoolean`](#isboolean)
* [`isFunction`](#isfunction)
* [`isMap`](#ismap)
* [`isNil`](#isnil)
* [`isNull`](#isnull)
* [`isNumber`](#isnumber)
* [`isObject`](#isobject)
@ -339,6 +341,7 @@ average(1, 2, 3);
* [`isString`](#isstring)
* [`isSymbol`](#issymbol)
* [`isTypedArray`](#istypedarray)
* [`isUndefined`](#isundefined)
* [`isValidJSON`](#isvalidjson)
* [`isWeakMap`](#isweakmap)
* [`isWeakSet`](#isweakset)
@ -1024,7 +1027,7 @@ initialize2DArray(2, 2, 0); // [[0,0], [0,0]]
### initializeArrayWithRange
Initializes an array containing the numbers in the specified range where `start` and `end` are inclusive with there common difference `step`.
Initializes an array containing the numbers in the specified range where `start` and `end` are inclusive with their common difference `step`.
Use `Array.from(Math.ceil((end+1-start)/step))` to create an array of the desired length(the amounts of elements is equal to `(end-start)/step` or `(end+1-start)/step` for inclusive end), `Array.map()` to fill with the desired values in a range.
You can omit `start` to use a default value of `0`.
@ -1049,6 +1052,35 @@ initializeArrayWithRange(9, 0, 2); // [0,2,4,6,8]
<br>[⬆ Back to top](#table-of-contents)
### initializeArrayWithRangeRight
Initializes an array containing the numbers in the specified range (in reverse) where `start` and `end` are inclusive with their common difference `step`.
Use `Array.from(Math.ceil((end+1-start)/step))` to create an array of the desired length(the amounts of elements is equal to `(end-start)/step` or `(end+1-start)/step` for inclusive end), `Array.map()` to fill with the desired values in a range.
You can omit `start` to use a default value of `0`.
You can omit `step` to use a default value of `1`.
```js
const initializeArrayWithRangeRight = (end, start = 0, step = 1) =>
Array.from({ length: Math.ceil((end + 1 - start) / step) }).map(
(v, i, arr) => (arr.length - i - 1) * step + start
);
```
<details>
<summary>Examples</summary>
```js
initializeArrayWithRangeRight(5); // [5,4,3,2,1,0]
initializeArrayWithRangeRight(7, 3); // [7,6,5,4,3]
initializeArrayWithRangeRight(9, 0, 2); // [8,6,4,2,0]
```
</details>
<br>[⬆ Back to top](#table-of-contents)
### initializeArrayWithValues
Initializes and fills an array with the specified values.
@ -5277,6 +5309,29 @@ isMap(new Map()); // true
<br>[⬆ Back to top](#table-of-contents)
### isNil
Returns `true` if the specified value is `null` or `undefined`, `false` otherwise.
Use the strict equality operator to check if the value and of `val` are equal to `null` or `undefined`.
```js
const isNil = val => val === undefined || val === null;
```
<details>
<summary>Examples</summary>
```js
isNil(null); // true
isNil(undefined); // true
```
</details>
<br>[⬆ Back to top](#table-of-contents)
### isNull
Returns `true` if the specified value is `null`, `false` otherwise.
@ -5520,6 +5575,28 @@ isTypedArray(new TypedArray()); // true
<br>[⬆ Back to top](#table-of-contents)
### isUndefined
Returns `true` if the specified value is `undefined`, `false` otherwise.
Use the strict equality operator to check if the value and of `val` are equal to `undefined`.
```js
const isUndefined = val => val === undefined;
```
<details>
<summary>Examples</summary>
```js
isUndefined(undefined); // true
```
</details>
<br>[⬆ Back to top](#table-of-contents)
### isValidJSON
Checks if the provided argument is a valid JSON.

File diff suppressed because one or more lines are too long

View File

@ -8,7 +8,9 @@ You can omit `step` to use a default value of `1`.
```js
const initializeArrayWithRangeRight = (end, start = 0, step = 1) =>
Array.from({ length: Math.ceil((end + 1 - start) / step) }).map((v, i, arr) => (arr.length - i - 1) * step + start);
Array.from({ length: Math.ceil((end + 1 - start) / step) }).map(
(v, i, arr) => (arr.length - i - 1) * step + start
);
```
```js