# lodash
# 防抖函数:debounce
import _ from 'lodash';
// 假设你有一个需要防抖的函数
function handleScroll() {
console.log('Scroll event triggered');
}
// 使用 lodash 的 debounce 函数来包装 handleScroll
const debouncedHandleScroll = _.debounce(handleScroll, 200);
// 将防抖后的函数绑定到滚动事件上
window.addEventListener('scroll', debouncedHandleScroll);
# uniq
import { uniq } from 'lodash-es';
const array = [1, 2, 2, 3, 4, 4, 5];
const uniqueArray = uniq(array);
console.log(uniqueArray); // 输出: [1, 2, 3, 4, 5]
# isEqual
lodash的isEqual函数用于比较两个对象是否相等。