Skip to content

Instantly share code, notes, and snippets.

View PachVerb's full-sized avatar
🎯
Focusing

new/bird PachVerb

🎯
Focusing
View GitHub Profile
let isArray = (arr) => arr instanceof Array;
function flaten(arr) {
if (arr.length === 0) return arr;
// 1. 分解:先找数组
if (isArray(arr)) {
arr.forEach((val) => {
flaten(val);
});
@PachVerb
PachVerb / seq_arr_singQuote.txt
Last active June 3, 2021 13:45
数组number成员序列化(包含索引)
* 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'";
@PachVerb
PachVerb / gist:0fe3d1509f779a2175acf0eae56d5786
Created September 24, 2020 07:04
时间戳转换成格式化日期
/*
** 时间戳转换成指定格式日期
** 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