Add yesterday snippets

This commit is contained in:
peter279k
2019-07-19 15:57:21 +08:00
parent 82ff65e607
commit ef310cb851
8 changed files with 63 additions and 3 deletions

6
dist/_30s.js vendored
View File

@@ -1356,6 +1356,11 @@
const xProd = (a, b) => a.reduce((acc, x) => acc.concat(b.map(y => [x, y])), []);
const yesNo = (val, def = false) =>
/^(y|yes)$/i.test(val) ? true : /^(n|no)$/i.test(val) ? false : def;
const yesterday = () => {
let t = new Date();
t.setDate(t.getDate() - 1);
return t.toISOString().split('T')[0];
};
const zip = (...arrays) => {
const maxLength = Math.max(...arrays.map(x => x.length));
return Array.from({ length: maxLength }).map((_, i) => {
@@ -1716,6 +1721,7 @@
exports.words = words;
exports.xProd = xProd;
exports.yesNo = yesNo;
exports.yesterday = yesterday;
exports.zip = zip;
exports.zipObject = zipObject;
exports.zipWith = zipWith;