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

@zhoutaimin_mac/jzlib

v1.0.0

Published

一个轻量级的、类似 Lodash 的 JavaScript 工具库

Readme

jzlib

🚀 一个轻量级、功能丰富的 JavaScript/TypeScript 工具库,类似 Lodash,但更小更快。

特点

类型安全 - 使用 TypeScript 编写,提供完整的类型定义

📦 模块化 - 支持按需导入,减少打包体积

高性能 - 精心优化的实现

🔧 易于扩展 - 清晰的项目结构,易于添加新功能

📚 良好文档 - 每个函数都有详细的文档和示例

安装

npm install jzlib

快速开始

完整导入

import * as _ from 'jzlib';

_.chunk([1, 2, 3, 4, 5], 2);  // [[1, 2], [3, 4], [5]]
_.capitalize('hello');           // 'Hello'

按需导入

import { chunk, capitalize } from 'jzlib';

chunk([1, 2, 3, 4, 5], 2);   // [[1, 2], [3, 4], [5]]
capitalize('hello');          // 'Hello'

模块导入

import * as array from 'jzlib/array';
import * as object from 'jzlib/object';
import * as string from 'jzlib/string';

array.chunk([1, 2, 3, 4], 2);
object.pick({ a: 1, b: 2 }, ['a']);
string.capitalize('world');

📚 API 文档

数组 (Array)

chunk(array, size)

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

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

compact(array)

移除数组中的虚值。

compact([0, 1, false, 2, '', 3, undefined, 4, null, NaN]);
// => [1, 2, 3, 4]

对象 (Object)

pick(obj, keys)

从对象中选择指定的属性。

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

omit(obj, keys)

从对象中排除指定的属性。

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

字符串 (String)

capitalize(str)

将字符串首字母转为大写。

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

camelCase(str)

将字符串转换为驼峰式命名法。

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

工具函数 (Utility)

类型检查

  • isString(value) - 检查是否为字符串
  • isNumber(value) - 检查是否为数字
  • isBoolean(value) - 检查是否为布尔值
  • isArray(value) - 检查是否为数组
  • isObject(value) - 检查是否为对象
  • isFunction(value) - 检查是否为函数
  • isDate(value) - 检查是否为日期
  • isRegExp(value) - 检查是否为正则表达式
  • isMap(value) - 检查是否为 Map
  • isSet(value) - 检查是否为 Set
  • isNull(value) - 检查是否为 null
  • isUndefined(value) - 检查是否为 undefined
  • isNullOrUndefined(value) - 检查是否为 null 或 undefined

isEmpty(value)

检查值是否为空。

isEmpty([]);        // => true
isEmpty({});        // => true
isEmpty('');        // => true
isEmpty(null);      // => true
isEmpty('hello');   // => false

开发

安装依赖

npm install

构建

npm run build

开发模式(监视文件变化)

npm run dev

运行测试

npm test

查看测试覆盖率

npm run test:coverage

代码格式化

npm run format

Linting

npm run lint

项目结构

src/
├── index.ts           # 主入口
├── types/             # 类型定义
├── array/             # 数组模块
├── object/            # 对象模块
├── string/            # 字符串模块
└── utility/           # 工具函数模块

许可证

MIT

贡献

欢迎贡献!请提交 PR 或 Issue。