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

@wp-001/fe-toolkit

v0.1.0

Published

A lightweight frontend utility toolkit with 100+ common helpers for Vue, React, Vite, Nuxt and TypeScript projects.

Readme

@wp-001/fe-toolkit

一个轻量级前端工具函数库,适合 Vue、React、Vite、Nuxt 和 TypeScript 项目使用。

当前版本内置 100+ 常用函数,覆盖类型判断、字符串、数字、数组、对象、URL、日期、树结构、异步函数、缓存、浏览器能力、ID 生成等常用业务场景。

安装

pnpm add @wp-001/fe-toolkit

也可以使用 npm:

npm install @wp-001/fe-toolkit

使用

import {
  isEmpty,
  debounce,
  formatDate,
  listToTree,
  localCache,
  camelCase,
  formatMoney,
  objectToQuery
} from '@wp-001/fe-toolkit';

console.log(isEmpty(''));
console.log(camelCase('hello-world'));
console.log(formatDate(new Date(), 'YYYY-MM-DD'));
console.log(formatMoney(123456.789, 2, '¥'));
console.log(objectToQuery({ page: 1, keyword: 'test' }));

const handleSearch = debounce(() => {
  console.log('search');
}, 300);

localCache.set('token', '123456');
console.log(localCache.get('token'));

const tree = listToTree([
  { id: '1', parentId: null, name: '一级' },
  { id: '2', parentId: '1', name: '二级' }
]);

模块能力

类型判断

getType,
isNull,
isUndefined,
isNil,
isString,
isNumber,
isBoolean,
isFunction,
isObject,
isPlainObject,
isArray,
isDate,
isRegExp,
isPromise,
isMap,
isSet,
isBlob,
isFile,
isEmpty,
isEqual

字符串

capitalize,
uncapitalize,
camelCase,
pascalCase,
kebabCase,
snakeCase,
trim,
trimStart,
trimEnd,
removeSpaces,
truncate,
maskString,
maskPhone,
maskEmail,
randomString,
escapeHtml,
unescapeHtml,
stripHtml,
startsWith,
endsWith,
contains,
countText,
repeatString,
padLeft,
padRight

数字与金额

toNumber,
clamp,
randomInt,
randomFloat,
round,
floorTo,
ceilTo,
sum,
average,
min,
max,
formatNumber,
formatMoney,
toPercent,
bytesToSize,
fileSizeToBytes,
isBetween

数组

unique,
uniqueBy,
chunk,
flatten,
compact,
groupBy,
sortBy,
orderBy,
removeItem,
moveItem,
range,
sample,
shuffle,
intersection,
difference,
union,
first,
last,
partition,
countBy

对象

deepClone,
deepMerge,
pick,
omit,
getValue,
setValue,
hasValue,
removeValue,
renameKey,
mapValues,
filterObject,
clearEmpty,
objectToArray,
arrayToObject,
freezeDeep,
safeJsonParse,
safeJsonStringify

URL

objectToQuery,
queryToObject,
getQueryParam,
setQueryParam,
removeQueryParam,
joinUrl,
normalizeUrl,
parseUrl,
isAbsoluteUrl,
addUrlPrefix

日期时间

formatDate,
addDays,
addMonths,
addYears,
startOfDay,
endOfDay,
diffDays,
isToday,
isYesterday,
isTomorrow,
getWeekday,
getMonthDays,
formatDuration,
timeAgo,
isValidDate,
compareDate

树结构

listToTree,
treeToList,
findTreeNode,
mapTree,
filterTree,
getTreePath,
eachTree,
removeTreeNode

函数与异步

debounce,
throttle,
sleep,
once,
retry,
waitUntil,
noop,
createQueue,
runTasksLimit,
memoize

缓存

createCache,
localCache,
sessionCache,
getStorageItem,
setStorageItem

浏览器

copyText,
downloadBlob,
downloadText,
downloadJson,
downloadUrl,
getCookie,
setCookie,
removeCookie,
getViewportSize,
scrollToTop,
isBrowser

ID

createId,
uuid,
nanoid

开发

pnpm install
pnpm test
pnpm typecheck
pnpm build
pnpm pack:check

发布

当前包名已经设置为:

{
  "name": "@wp-001/fe-toolkit",
  "version": "0.1.0"
}

发布前建议先执行:

pnpm test
pnpm typecheck
pnpm build
pnpm pack:check

然后发布:

pnpm publish

如果需要手动指定公开发布:

pnpm publish --access public

版本升级

修 bug:

pnpm version patch
pnpm publish

新增功能:

pnpm version minor
pnpm publish

破坏性升级:

pnpm version major
pnpm publish