前端常用工具库
未读
Lodash 函数列表 · 对象
assign 合并对象的属性,后面的对象的属性会覆盖前面的对象 const assign = (...objs) =>
objs.reduce((result, obj) => Object.assign(result, obj), {});
function Foo() {
this.
前端常用工具库
未读
Lodash 函数列表 · 函数
after 指定一个函数在被调用多少次后执行 const after = (n, func) => {
let count = 0;
return (...args) => {
count++;
if (count >= n) {
return func(...a
前端常用工具库
未读
Lodash 函数列表 · 集合
countBy 统计数组中每个元素出现的次数 const countBy = (arr, fn) =>
arr.map(typeof fn === 'function' ? fn : val => val[fn]).reduce((acc, val) => {
acc[val] = (a
前端常用工具库
未读
Lodash 函数列表 · 数组
chunk 将一个数组分成多个小数组 const chunk = (arr, size) =>
Array.from({ length: Math.ceil(arr.length / size) }, (v, i) =>
arr.slice(i * size, i * size + si