Travis build: 563 [cron]

This commit is contained in:
30secondsofcode
2018-09-29 20:15:22 +00:00
parent 920f8a445b
commit eca8ab3152
9 changed files with 1758 additions and 1601 deletions

View File

@ -958,6 +958,26 @@
"hash": "e3b0d5ff10d79034d6ccc448282097089b084ed71c608bc8f3468c0a8533ec14"
}
},
{
"id": "dayOfYear",
"type": "snippet",
"attributes": {
"fileName": "dayOfYear.md",
"text": "Gets the day of the year from a `Date` object.\n\nUse `new Date()` and `Date.prototype.getFullYear()` to get the first day of the year as a `Date` object, subtract it from the provided `date` and divide with the milliseconds in each day to get the result.\nUse `Math.floor()` to appropriately round the resulting day count to an integer.",
"codeBlocks": [
"const dayOfYear = date =>\n Math.floor((date - new Date(date.getFullYear(), 0, 0)) / 1000 / 60 / 60 / 24);",
"dayOfYear(new Date()); // 272"
],
"tags": [
"date",
"beginner"
]
},
"meta": {
"archived": false,
"hash": "389ee2f96db160f9ab0ed4aa38c69a1eebf93d785c8baf82afe0ee84c611a57d"
}
},
{
"id": "debounce",
"type": "snippet",
@ -2744,6 +2764,27 @@
"hash": "74e18a4c018b09d172b04daec6aeab29297b83986bb846028fc20ab1300c84a5"
}
},
{
"id": "isAfterDate",
"type": "snippet",
"attributes": {
"fileName": "isAfterDate.md",
"text": "Check if a date is after another date.\n\nUse the greater than operator (`>`) to check if the first date comes after the second one.",
"codeBlocks": [
"const isAfterDate = (dateA, dateB) => dateA > dateB;",
"isAfterDate(new Date(2010, 10, 21), new Date(2010, 10, 20)); // true"
],
"tags": [
"date",
"utility",
"beginner"
]
},
"meta": {
"archived": false,
"hash": "78974cc479b0d3a51b7795c5679cbab9601cdd90716a69947799ebe302a7d515"
}
},
{
"id": "isAnagram",
"type": "snippet",
@ -2786,6 +2827,27 @@
"hash": "00b43a2b430d5d9205046ad6fbf7442f0d4507895c82545753253b5b5f97fa3a"
}
},
{
"id": "isBeforeDate",
"type": "snippet",
"attributes": {
"fileName": "isBeforeDate.md",
"text": "Check if a date is before another date.\n\nUse the less than operator (`<`) to check if the first date comes before the second one.",
"codeBlocks": [
"const isBeforeDate = (dateA, dateB) => dateA < dateB;",
"isBeforeDate(new Date(2010, 10, 20), new Date(2010, 10, 21)); // true"
],
"tags": [
"date",
"utility",
"beginner"
]
},
"meta": {
"archived": false,
"hash": "947340a879922379186ddecda22c625bc4db21948dc619e445abd95da21d0a1c"
}
},
{
"id": "isBoolean",
"type": "snippet",
@ -3142,6 +3204,27 @@
"hash": "fa8bfc91bfa09eb76f7131c3cc7b890598f8a30ec9e9872f7ffd9c282d37ba72"
}
},
{
"id": "isSameDate",
"type": "snippet",
"attributes": {
"fileName": "isSameDate.md",
"text": "Check if a date is the same as another date.\n\nUse `Date.prototype.toISOString()` and strict equality checking (`===`) to check if the first date is the same as the second one.",
"codeBlocks": [
"const isSameDate = (dateA, dateB) => dateA.toISOString() === dateB.toISOString();",
"isSameDate(new Date(2010, 10, 20), new Date(2010, 10, 20)); // true"
],
"tags": [
"date",
"utility",
"beginner"
]
},
"meta": {
"archived": false,
"hash": "a57a8fe6a89b45bd11bcfeb71321839b5ae9c6a3789dfc6670be4a71d705f703"
}
},
{
"id": "isSorted",
"type": "snippet",
@ -3625,6 +3708,27 @@
"hash": "00851da4972ff91286aecc46f1070ce619d0d64287ac6a8c90b6f8f3c0da2abc"
}
},
{
"id": "maxDate",
"type": "snippet",
"attributes": {
"fileName": "maxDate.md",
"text": "Returns the maximum of the given dates.\n\nUse `Math.max.apply()` to find the maximum date value, `new Date()` to convert it to a `Date` object.",
"codeBlocks": [
"const maxDate = (...dates) => new Date(Math.max.apply(null, ...dates));",
"const array = [\n new Date(2017, 4, 13),\n new Date(2018, 2, 12),\n new Date(2016, 0, 10),\n new Date(2016, 0, 9)\n];\nmaxDate(array); // 2018-03-11T22:00:00.000Z"
],
"tags": [
"date",
"math",
"beginner"
]
},
"meta": {
"archived": false,
"hash": "8d1b95da3bac65bf8a1801edfd1efce94ea17902669a7612c5a0138fad9d0b12"
}
},
{
"id": "maxN",
"type": "snippet",
@ -3730,6 +3834,27 @@
"hash": "58be8a0dc3e56ec09b0bb927c2c575c033c70ac3a8b612e993fdcbf6d5a99d51"
}
},
{
"id": "minDate",
"type": "snippet",
"attributes": {
"fileName": "minDate.md",
"text": "Returns the minimum of the given dates.\n\nUse `Math.min.apply()` to find the minimum date value, `new Date()` to convert it to a `Date` object.",
"codeBlocks": [
"const minDate = (...dates) => new Date(Math.min.apply(null, ...dates));",
"const array = [\n new Date(2017, 4, 13),\n new Date(2018, 2, 12),\n new Date(2016, 0, 10),\n new Date(2016, 0, 9)\n];\nminDate(array); // 2016-01-08T22:00:00.000Z"
],
"tags": [
"date",
"math",
"beginner"
]
},
"meta": {
"archived": false,
"hash": "436e070c2961cd8cbeffbc05fae7b3fa978eefe1e048de248bc17b86a2b06705"
}
},
{
"id": "minN",
"type": "snippet",
@ -6002,7 +6127,7 @@
"type": "snippet",
"attributes": {
"fileName": "tomorrow.md",
"text": "Results in a string representation of tomorrow's date.\nUse `new Date()` to get today's date, adding one day using `Date.getDate()` and `Date.setDate()`, and converting the Date object to a string.",
"text": "Results in a string representation of tomorrow's date.\n\nUse `new Date()` to get today's date, adding one day using `Date.getDate()` and `Date.setDate()`, and converting the Date object to a string.",
"codeBlocks": [
"const tomorrow = (long = false) => {\n let t = new Date();\n t.setDate(t.getDate() + 1);\n const ret = `${t.getFullYear()}-${String(t.getMonth() + 1).padStart(2, '0')}-${String(\n t.getDate()\n ).padStart(2, '0')}`;\n return !long ? ret : `${ret}T00:00:00`;\n};",
"tomorrow(); // 2017-12-27 (if current date is 2017-12-26)\ntomorrow(true); // 2017-12-27T00:00:00 (if current date is 2017-12-26)"
@ -6014,7 +6139,7 @@
},
"meta": {
"archived": false,
"hash": "55531d99aa0019593ea79a1bf0a3383857d88f6c7fdb33399a7812c0d184eb72"
"hash": "4794ae637e65b9c1ac43f6c964555a98cda83e1410684e11ed34753c81db35fb"
}
},
{

View File

@ -1,2 +1,2 @@
const degreesToRads = deg => deg * Math.PI / 180.0;
const degreesToRads = deg => (deg * Math.PI) / 180.0;
module.exports = degreesToRads;

View File

@ -4,6 +4,6 @@ const getMeridiemSuffixOfInteger = num =>
: num === 12
? 12 + 'pm'
: num < 12
? num % 12 + 'am'
: num % 12 + 'pm';
? (num % 12) + 'am'
: (num % 12) + 'pm';
module.exports = getMeridiemSuffixOfInteger;

View File

@ -1,6 +1,6 @@
const hz = (fn, iterations = 100) => {
const before = performance.now();
for (let i = 0; i < iterations; i++) fn();
return 1000 * iterations / (performance.now() - before);
return (1000 * iterations) / (performance.now() - before);
};
module.exports = hz;

View File

@ -1,6 +1,6 @@
const lcm = (...arr) => {
const gcd = (x, y) => (!y ? x : gcd(y, x % y));
const _lcm = (x, y) => x * y / gcd(x, y);
const _lcm = (x, y) => (x * y) / gcd(x, y);
return [...arr].reduce((a, b) => _lcm(a, b));
};
module.exports = lcm;

View File

@ -4,7 +4,7 @@ const luhnCheck = num => {
.reverse()
.map(x => parseInt(x));
let lastDigit = arr.splice(0, 1)[0];
let sum = arr.reduce((acc, val, i) => (i % 2 !== 0 ? acc + val : acc + (val * 2) % 9 || 9), 0);
let sum = arr.reduce((acc, val, i) => (i % 2 !== 0 ? acc + val : acc + ((val * 2) % 9) || 9), 0);
sum += lastDigit;
return sum % 10 === 0;
};

View File

@ -1,3 +1,3 @@
const percentile = (arr, val) =>
100 * arr.reduce((acc, v) => acc + (v < val ? 1 : 0) + (v === val ? 0.5 : 0), 0) / arr.length;
(100 * arr.reduce((acc, v) => acc + (v < val ? 1 : 0) + (v === val ? 0.5 : 0), 0)) / arr.length;
module.exports = percentile;

View File

@ -1,2 +1,2 @@
const radsToDegrees = rad => rad * 180.0 / Math.PI;
const radsToDegrees = rad => (rad * 180.0) / Math.PI;
module.exports = radsToDegrees;

File diff suppressed because it is too large Load Diff