This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
** 时间戳转换成指定格式日期 | |
** eg. | |
** dateFormat(11111111111111, 'Y年m月d日 H时i分') | |
** → "2322年02月06日 03时45分" | |
*/ | |
var dateFormat = function (timestamp, formats) { | |
// formats格式包括 | |
// 1. Y-m-d | |
// 2. Y-m-d H:i:s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* note: From a reasonable point of view.This method only works with members of the JS base datatype -number. | |
Include sheet but not limited to other types, can also be used. Whether reasonable, please consider。 | |
// single quotes | |
const seqarr = (arr) => "'" + arr.join("','") + "'"; | |
// test func | |
seqarr([1, 2, 3]) // -> "'1', '2', '3'"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let isArray = (arr) => arr instanceof Array; | |
function flaten(arr) { | |
if (arr.length === 0) return arr; | |
// 1. 分解:先找数组 | |
if (isArray(arr)) { | |
arr.forEach((val) => { | |
flaten(val); | |
}); |