npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@hilime/lodash-mini

v1.0.0

Published

一个使用 esbuild 构建的工具函数库

Readme

@hilime/lodash-mini

一个使用 esbuild 构建的轻量级工具函数库,支持多种模块格式

✨ 特性

  • 🚀 快速构建 - 使用 esbuild 构建,速度极快
  • 📦 多格式支持 - 支持 ESM、CommonJS、IIFE 三种格式
  • 🔧 TypeScript 支持 - 完整的类型定义
  • 🪶 轻量级 - 打包后仅 2-3KB
  • 🌳 Tree-shaking 友好 - 支持按需导入

📦 安装

npm install @hilime/lodash-mini

🚀 快速开始

ESM (推荐)

import { isArray, chunk, debounce } from '@hilime/lodash-mini';

// 或者导入所有功能
import limeLodash from '@hilime/lodash-mini';

CommonJS

const { isArray, chunk, debounce } = require('@hilime/lodash-mini');

// 或者导入所有功能
const limeLodash = require('@hilime/lodash-mini');

浏览器 (IIFE)

<script src="path/to/@hilime/lodash-mini/dist/index.iife.js"></script>
<script>
  // 全局变量 LimeLodash 可用
  console.log(LimeLodash.isArray([1, 2, 3])); // true
</script>

📚 API 文档

类型检查

isArray(value): boolean

检查值是否为数组

isArray([1, 2, 3]); // true
isArray('hello'); // false

isObject(value): boolean

检查值是否为对象(非数组)

isObject({}); // true
isObject([]); // false

isEmpty(value): boolean

检查值是否为空

isEmpty([]); // true
isEmpty(''); // true
isEmpty({}); // true
isEmpty([1]); // false

数组操作

chunk(array, size): array[]

将数组分割成指定大小的块

chunk([1, 2, 3, 4, 5], 2); // [[1, 2], [3, 4], [5]]

flatten(array): array

展平多维数组

flatten([1, [2, 3], [4, [5]]]); // [1, 2, 3, 4, 5]

uniq(array): array

数组去重

uniq([1, 2, 2, 3, 3]); // [1, 2, 3]

groupBy(array, keyFn): object

根据指定函数对数组元素进行分组

const people = [
  { name: 'Alice', age: 30 },
  { name: 'Bob', age: 25 },
  { name: 'Charlie', age: 30 }
];
groupBy(people, person => person.age);
// { '25': [{ name: 'Bob', age: 25 }], '30': [{ name: 'Alice', age: 30 }, { name: 'Charlie', age: 30 }] }

对象操作

pick(object, keys): object

从对象中挑选指定的属性

pick({ a: 1, b: 2, c: 3 }, ['a', 'c']); // { a: 1, c: 3 }

omit(object, keys): object

从对象中排除指定的属性

omit({ a: 1, b: 2, c: 3 }, ['b']); // { a: 1, c: 3 }

merge(target, ...sources): object

深度合并对象

merge({ a: 1, b: { x: 1 } }, { b: { y: 2 }, c: 3 }); 
// { a: 1, b: { x: 1, y: 2 }, c: 3 }

字符串操作

capitalize(str): string

首字母大写

capitalize('hello'); // 'Hello'

camelCase(str): string

转换为驼峰命名

camelCase('hello-world'); // 'helloWorld'

kebabCase(str): string

转换为短横线命名

kebabCase('helloWorld'); // 'hello-world'

性能工具

debounce(func, wait): function

防抖函数

const debouncedFn = debounce(() => {
  console.log('执行');
}, 1000);

// 在1秒内多次调用,只会执行一次
debouncedFn();
debouncedFn();
debouncedFn();

throttle(func, wait): function

节流函数

const throttledFn = throttle(() => {
  console.log('执行');
}, 1000);

// 每秒最多执行一次
throttledFn();
throttledFn(); // 被忽略

🏗️ 开发

构建

# 构建所有格式
npm run build

# 开发模式构建(包含 sourcemap)
npm run build:dev

# 监听模式
npm run dev

测试

npm test

清理

npm run clean

📊 构建产物

  • dist/index.esm.js - ESM 格式 (~2.3KB)
  • dist/index.cjs.js - CommonJS 格式 (~2.8KB)
  • dist/index.iife.js - IIFE 格式 (~2.7KB)
  • dist/index.d.ts - TypeScript 类型定义 (~1.5KB)

🤝 贡献

欢迎提交 Issue 和 Pull Request!

📄 许可证

MIT

🔗 相关链接