Travis build: 1572 [cron]

This commit is contained in:
30secondsofcode
2018-02-04 20:17:40 +00:00
parent 34f4a7e6fe
commit 998af8f9e2
7 changed files with 1703 additions and 1703 deletions

8
dist/_30s.es5.js vendored
View File

@ -625,7 +625,7 @@ var findLastKey = function findLastKey(obj, fn) {
var flatten = function flatten(arr) {
var depth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
return depth != 1 ? arr.reduce(function (a, v) {
return depth !== 1 ? arr.reduce(function (a, v) {
return a.concat(Array.isArray(v) ? flatten(v, depth - 1) : v);
}, []) : arr.reduce(function (a, v) {
return a.concat(v);
@ -1020,7 +1020,7 @@ var isPlainObject = function isPlainObject(val) {
var isPrime = function isPrime(num) {
var boundary = Math.floor(Math.sqrt(num));
for (var i = 2; i <= boundary; i++) {
if (num % i == 0) return false;
if (num % i === 0) return false;
}return num >= 2;
};
@ -1106,7 +1106,7 @@ var join = function join(arr) {
var separator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ',';
var end = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : separator;
return arr.reduce(function (acc, val, i) {
return i == arr.length - 2 ? acc + val + end : i == arr.length - 1 ? acc + val : acc + val + separator;
return i === arr.length - 2 ? acc + val + end : i === arr.length - 1 ? acc + val : acc + val + separator;
}, '');
};
@ -1561,7 +1561,7 @@ var primes = function primes(num) {
});
numsTillSqroot.forEach(function (x) {
return arr = arr.filter(function (y) {
return y % x !== 0 || y == x;
return y % x !== 0 || y === x;
});
});
return arr;

File diff suppressed because one or more lines are too long

10
dist/_30s.esm.js vendored
View File

@ -349,7 +349,7 @@ const findLastKey = (obj, fn) =>
.find(key => fn(obj[key], key, obj));
const flatten = (arr, depth = 1) =>
depth != 1
depth !== 1
? arr.reduce((a, v) => a.concat(Array.isArray(v) ? flatten(v, depth - 1) : v), [])
: arr.reduce((a, v) => a.concat(v), []);
@ -608,7 +608,7 @@ const isPlainObject = val => !!val && typeof val === 'object' && val.constructor
const isPrime = num => {
const boundary = Math.floor(Math.sqrt(num));
for (var i = 2; i <= boundary; i++) if (num % i == 0) return false;
for (var i = 2; i <= boundary; i++) if (num % i === 0) return false;
return num >= 2;
};
@ -648,9 +648,9 @@ const isValidJSON = obj => {
const join = (arr, separator = ',', end = separator) =>
arr.reduce(
(acc, val, i) =>
i == arr.length - 2
i === arr.length - 2
? acc + val + end
: i == arr.length - 1 ? acc + val : acc + val + separator,
: i === arr.length - 1 ? acc + val : acc + val + separator,
''
);
@ -899,7 +899,7 @@ const primes = num => {
let arr = Array.from({ length: num - 1 }).map((x, i) => i + 2),
sqroot = Math.floor(Math.sqrt(num)),
numsTillSqroot = Array.from({ length: sqroot - 1 }).map((x, i) => i + 2);
numsTillSqroot.forEach(x => (arr = arr.filter(y => y % x !== 0 || y == x)));
numsTillSqroot.forEach(x => (arr = arr.filter(y => y % x !== 0 || y === x)));
return arr;
};

10
dist/_30s.js vendored
View File

@ -355,7 +355,7 @@ const findLastKey = (obj, fn) =>
.find(key => fn(obj[key], key, obj));
const flatten = (arr, depth = 1) =>
depth != 1
depth !== 1
? arr.reduce((a, v) => a.concat(Array.isArray(v) ? flatten(v, depth - 1) : v), [])
: arr.reduce((a, v) => a.concat(v), []);
@ -614,7 +614,7 @@ const isPlainObject = val => !!val && typeof val === 'object' && val.constructor
const isPrime = num => {
const boundary = Math.floor(Math.sqrt(num));
for (var i = 2; i <= boundary; i++) if (num % i == 0) return false;
for (var i = 2; i <= boundary; i++) if (num % i === 0) return false;
return num >= 2;
};
@ -654,9 +654,9 @@ const isValidJSON = obj => {
const join = (arr, separator = ',', end = separator) =>
arr.reduce(
(acc, val, i) =>
i == arr.length - 2
i === arr.length - 2
? acc + val + end
: i == arr.length - 1 ? acc + val : acc + val + separator,
: i === arr.length - 1 ? acc + val : acc + val + separator,
''
);
@ -905,7 +905,7 @@ const primes = num => {
let arr = Array.from({ length: num - 1 }).map((x, i) => i + 2),
sqroot = Math.floor(Math.sqrt(num)),
numsTillSqroot = Array.from({ length: sqroot - 1 }).map((x, i) => i + 2);
numsTillSqroot.forEach(x => (arr = arr.filter(y => y % x !== 0 || y == x)));
numsTillSqroot.forEach(x => (arr = arr.filter(y => y % x !== 0 || y === x)));
return arr;
};

2
dist/_30s.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -81,12 +81,12 @@ speechSynthesis('Hello, World'); // // plays the message
### binarySearch
Use recursion. Similar to `Array.indexOf()` that finds the index of a value within an array.
Use recursion. Similar to `Array.indexOf()` that finds the index of a value within an array.
The difference being this operation only works with sorted arrays which offers a major performance boost due to it's logarithmic nature when compared to a linear search or `Array.indexOf()`.
Search a sorted array by repeatedly dividing the search interval in half.
Begin with an interval covering the whole array.
If the value of the search is less than the item in the middle of the interval, recurse into the lower half. Otherwise recurse into the upper half.
Search a sorted array by repeatedly dividing the search interval in half.
Begin with an interval covering the whole array.
If the value of the search is less than the item in the middle of the interval, recurse into the lower half. Otherwise recurse into the upper half.
Repeatedly recurse until the value is found which is the mid or you've recursed to a point that is greater than the length which means the value doesn't exist and return `-1`.
```js
@ -96,8 +96,8 @@ const binarySearch = (arr, val, start = 0, end = arr.length - 1) => {
if (arr[mid] > val) return binarySearch(arr, val, start, mid - 1);
if (arr[mid] < val) return binarySearch(arr, val, mid + 1, end);
return mid;
}
```
};
```
<details>
<summary>Examples</summary>
@ -152,7 +152,7 @@ Applies the Collatz algorithm.
If `n` is even, return `n/2`. Otherwise, return `3n+1`.
```js
const collatz = n => (n % 2 == 0 ? n / 2 : 3 * n + 1);
const collatz = n => (n % 2 === 0 ? n / 2 : 3 * n + 1);
```
<details>

File diff suppressed because it is too large Load Diff