Travis build: 563 [cron]
This commit is contained in:
@ -958,6 +958,26 @@
|
|||||||
"hash": "e3b0d5ff10d79034d6ccc448282097089b084ed71c608bc8f3468c0a8533ec14"
|
"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",
|
"id": "debounce",
|
||||||
"type": "snippet",
|
"type": "snippet",
|
||||||
@ -2744,6 +2764,27 @@
|
|||||||
"hash": "74e18a4c018b09d172b04daec6aeab29297b83986bb846028fc20ab1300c84a5"
|
"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",
|
"id": "isAnagram",
|
||||||
"type": "snippet",
|
"type": "snippet",
|
||||||
@ -2786,6 +2827,27 @@
|
|||||||
"hash": "00b43a2b430d5d9205046ad6fbf7442f0d4507895c82545753253b5b5f97fa3a"
|
"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",
|
"id": "isBoolean",
|
||||||
"type": "snippet",
|
"type": "snippet",
|
||||||
@ -3142,6 +3204,27 @@
|
|||||||
"hash": "fa8bfc91bfa09eb76f7131c3cc7b890598f8a30ec9e9872f7ffd9c282d37ba72"
|
"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",
|
"id": "isSorted",
|
||||||
"type": "snippet",
|
"type": "snippet",
|
||||||
@ -3625,6 +3708,27 @@
|
|||||||
"hash": "00851da4972ff91286aecc46f1070ce619d0d64287ac6a8c90b6f8f3c0da2abc"
|
"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",
|
"id": "maxN",
|
||||||
"type": "snippet",
|
"type": "snippet",
|
||||||
@ -3730,6 +3834,27 @@
|
|||||||
"hash": "58be8a0dc3e56ec09b0bb927c2c575c033c70ac3a8b612e993fdcbf6d5a99d51"
|
"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",
|
"id": "minN",
|
||||||
"type": "snippet",
|
"type": "snippet",
|
||||||
@ -6002,7 +6127,7 @@
|
|||||||
"type": "snippet",
|
"type": "snippet",
|
||||||
"attributes": {
|
"attributes": {
|
||||||
"fileName": "tomorrow.md",
|
"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": [
|
"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};",
|
"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)"
|
"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": {
|
"meta": {
|
||||||
"archived": false,
|
"archived": false,
|
||||||
"hash": "55531d99aa0019593ea79a1bf0a3383857d88f6c7fdb33399a7812c0d184eb72"
|
"hash": "4794ae637e65b9c1ac43f6c964555a98cda83e1410684e11ed34753c81db35fb"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,2 +1,2 @@
|
|||||||
const degreesToRads = deg => deg * Math.PI / 180.0;
|
const degreesToRads = deg => (deg * Math.PI) / 180.0;
|
||||||
module.exports = degreesToRads;
|
module.exports = degreesToRads;
|
||||||
|
|||||||
@ -4,6 +4,6 @@ const getMeridiemSuffixOfInteger = num =>
|
|||||||
: num === 12
|
: num === 12
|
||||||
? 12 + 'pm'
|
? 12 + 'pm'
|
||||||
: num < 12
|
: num < 12
|
||||||
? num % 12 + 'am'
|
? (num % 12) + 'am'
|
||||||
: num % 12 + 'pm';
|
: (num % 12) + 'pm';
|
||||||
module.exports = getMeridiemSuffixOfInteger;
|
module.exports = getMeridiemSuffixOfInteger;
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
const hz = (fn, iterations = 100) => {
|
const hz = (fn, iterations = 100) => {
|
||||||
const before = performance.now();
|
const before = performance.now();
|
||||||
for (let i = 0; i < iterations; i++) fn();
|
for (let i = 0; i < iterations; i++) fn();
|
||||||
return 1000 * iterations / (performance.now() - before);
|
return (1000 * iterations) / (performance.now() - before);
|
||||||
};
|
};
|
||||||
module.exports = hz;
|
module.exports = hz;
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
const lcm = (...arr) => {
|
const lcm = (...arr) => {
|
||||||
const gcd = (x, y) => (!y ? x : gcd(y, x % y));
|
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));
|
return [...arr].reduce((a, b) => _lcm(a, b));
|
||||||
};
|
};
|
||||||
module.exports = lcm;
|
module.exports = lcm;
|
||||||
|
|||||||
@ -4,7 +4,7 @@ const luhnCheck = num => {
|
|||||||
.reverse()
|
.reverse()
|
||||||
.map(x => parseInt(x));
|
.map(x => parseInt(x));
|
||||||
let lastDigit = arr.splice(0, 1)[0];
|
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;
|
sum += lastDigit;
|
||||||
return sum % 10 === 0;
|
return sum % 10 === 0;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,3 +1,3 @@
|
|||||||
const percentile = (arr, val) =>
|
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;
|
module.exports = percentile;
|
||||||
|
|||||||
@ -1,2 +1,2 @@
|
|||||||
const radsToDegrees = rad => rad * 180.0 / Math.PI;
|
const radsToDegrees = rad => (rad * 180.0) / Math.PI;
|
||||||
module.exports = radsToDegrees;
|
module.exports = radsToDegrees;
|
||||||
|
|||||||
3214
test/testlog
3214
test/testlog
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user