Travis build: 1265
This commit is contained in:
79
README.md
79
README.md
@ -112,6 +112,7 @@ average(1, 2, 3);
|
|||||||
* [`initial`](#initial)
|
* [`initial`](#initial)
|
||||||
* [`initialize2DArray`](#initialize2darray)
|
* [`initialize2DArray`](#initialize2darray)
|
||||||
* [`initializeArrayWithRange`](#initializearraywithrange)
|
* [`initializeArrayWithRange`](#initializearraywithrange)
|
||||||
|
* [`initializeArrayWithRangeRight`](#initializearraywithrangeright)
|
||||||
* [`initializeArrayWithValues`](#initializearraywithvalues)
|
* [`initializeArrayWithValues`](#initializearraywithvalues)
|
||||||
* [`intersection`](#intersection)
|
* [`intersection`](#intersection)
|
||||||
* [`isSorted`](#issorted)
|
* [`isSorted`](#issorted)
|
||||||
@ -329,6 +330,7 @@ average(1, 2, 3);
|
|||||||
* [`isBoolean`](#isboolean)
|
* [`isBoolean`](#isboolean)
|
||||||
* [`isFunction`](#isfunction)
|
* [`isFunction`](#isfunction)
|
||||||
* [`isMap`](#ismap)
|
* [`isMap`](#ismap)
|
||||||
|
* [`isNil`](#isnil)
|
||||||
* [`isNull`](#isnull)
|
* [`isNull`](#isnull)
|
||||||
* [`isNumber`](#isnumber)
|
* [`isNumber`](#isnumber)
|
||||||
* [`isObject`](#isobject)
|
* [`isObject`](#isobject)
|
||||||
@ -339,6 +341,7 @@ average(1, 2, 3);
|
|||||||
* [`isString`](#isstring)
|
* [`isString`](#isstring)
|
||||||
* [`isSymbol`](#issymbol)
|
* [`isSymbol`](#issymbol)
|
||||||
* [`isTypedArray`](#istypedarray)
|
* [`isTypedArray`](#istypedarray)
|
||||||
|
* [`isUndefined`](#isundefined)
|
||||||
* [`isValidJSON`](#isvalidjson)
|
* [`isValidJSON`](#isvalidjson)
|
||||||
* [`isWeakMap`](#isweakmap)
|
* [`isWeakMap`](#isweakmap)
|
||||||
* [`isWeakSet`](#isweakset)
|
* [`isWeakSet`](#isweakset)
|
||||||
@ -1024,7 +1027,7 @@ initialize2DArray(2, 2, 0); // [[0,0], [0,0]]
|
|||||||
|
|
||||||
### initializeArrayWithRange
|
### 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.
|
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 `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)
|
<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
|
### initializeArrayWithValues
|
||||||
|
|
||||||
Initializes and fills an array with the specified values.
|
Initializes and fills an array with the specified values.
|
||||||
@ -5277,6 +5309,29 @@ isMap(new Map()); // true
|
|||||||
<br>[⬆ Back to top](#table-of-contents)
|
<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
|
### isNull
|
||||||
|
|
||||||
Returns `true` if the specified value is `null`, `false` otherwise.
|
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)
|
<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
|
### isValidJSON
|
||||||
|
|
||||||
Checks if the provided argument is a valid JSON.
|
Checks if the provided argument is a valid JSON.
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -8,7 +8,9 @@ You can omit `step` to use a default value of `1`.
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
const initializeArrayWithRangeRight = (end, start = 0, step = 1) =>
|
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
|
```js
|
||||||
|
|||||||
Reference in New Issue
Block a user