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

fdutils

v1.0.5

Published

前端基础工具库

Downloads

18

Readme

前端基础工具库(最新版本:1.0.5)

目的:节省时间,高效完成工作;

使用与安装;

支持UMD模式的使用;

  1. 直接引入;

直接下载:fdutils.min.js

单元测试:fdutils

直接使用script引入,引入之后,就可以按照项目中的模块加载机制,进行加载(未使用模块加载机制则直接使用全局变量:fdutils);

  1. npm 包
$ npm i fdutils

新增错误处理(1.0.4版本)

在使用过程中,也许你会碰到一些兼容问题,所以这里统一处理了错误上报;

但是,需要使用者,自己做一些工作,自定义上报的函数;

/**
 * data.name ,异常的方法
 * data.message,异常的信息;
 */
fdutils.error = function (data) {
	let url = `//host.com/report?key1=error&name=${data.name}&message=${data.message}`;
	let img = new Image();
	img.src = url;
}

类似于上面的这种设置,万一在使用过程中,出现异常,因为这里的上报,可以让你迅速的排查解决问题; 而且,该错误上报,是一个全局的上报,所以你新增的一些方法,也无需专门调用该错误上报; 让你放心使用;

支持的API

  • isArray: (v:1.0.0) 判断是否为数组类型
  • isBoolean: (v:1.0.0) 判断是否为布尔值类型
  • isDate: (v:1.0.0) 判断是否为Date类型
  • isError: (v:1.0.0) 判断是否为Error对象
  • isFunction: (v:1.0.0) 判断是否为函数
  • isLeapYear: (v:1.0.0) 判断是否为闰年
  • isLogicString: (v:1.0.5) 判断字符串是否为一个合法的逻辑表达式
  • isNumber: (v:1.0.0) 判断是否为数字类型
  • isObject: (v:1.0.0) 判断是否为对象类型
  • isRegExp: (v:1.0.0) 判断是否为正则类型
  • isString: (v:1.0.0) 判断是否为字符串类型
  • colorRandom: (v:1.0.0) 生成一个随机的颜色
  • hexToRgb: (v:1.0.0) 根据hex的值,生成rgb格式的值,支持hex8 -> rgba
  • rgbToHex: (v:1.0.0) 根据rgb格式的值,生成hex格式的颜色值,支持rgba -> hex8
  • debounce: (v:1.0.0) 函数防抖,只触发最后一次调用;
  • throttle: (v:1.0.0) 函数节流,一定时间内,只执行一次回调函数
  • numberFormat: (v:1.0.0) 把数字字符串进行分割,支持字符串类型的数字
  • deepClone: (v:1.0.0) 深copy,如果不是对象,则直接返回
  • objectToString: (v:1.0.0) 把规定格式的Object转换为String格式
  • xssDecode: (v:1.0.0) 进行XSS解码,与xssEncode配合使用
  • xssEncode: (v:1.0.0) 进行XSS编码,与xssDecode配合使用
  • stringToObject: (v:1.0.0) 把规定格式的Str转换为Object格式
  • dateFormat: (v:1.0.0) 转换为指定格式的时间
  • dateNature: (v:1.0.0) 根据传入的日期,转换出一些指定的节日信息
  • preciseCountDownTimer: (v:1.0.0) 倒计时的插件