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 🙏

© 2024 – Pkg Stats / Ryan Hefner

util-helpers

v5.4.2

Published

一个基于业务场景的工具方法库

Downloads

3,704

Readme

util-helpers

一个基于业务场景的工具方法库。点击查看在线文档

npm Build and Deploy Docs codecov npm GitHub

使用

esnode 开发环境

安装依赖

npm install util-helpers
yarn add util-helpers
pnpm add util-helpers

浏览器引入

如果你的项目使用的是原生方式开发,可以在浏览器中使用 script 标签直接引入文件,并使用全局变量 utilHelpers

npm 包的 util-helpers/dist 目录下提供了 UMDutil-helpers.js 以及 util-helpers.min.js。你也可以通过 UNPKG 下载到本地进行使用。或者直接使用 UNPKG 线上版本 注意版本

示例

import { formatMoney, formatBankCard } from 'util-helpers';

formatMoney('1000'); // 1,000.00

formatBankCard('6228480402564890018'); // 6228 4804 0256 4890 018
formatBankCard('6228480402564890018', { spaceMark: '-' }); // 6228-4804-0256-4890-018

文档

数学计算,修正了浮点数计算问题,适用于金额计算。参考:JS 浮点数计算测试

精选第三方工具库

  • ut2 - 一个现代 JavaScript 实用工具库
  • lodash - 封装了诸多对字符串、数组、对象等常见数据类型的处理函数
  • query-string - URL 解析、序列化
  • qs - URL 查询字符串解析和序列化库
  • js-cookie - 一个简单,轻量级的 JavaScript API,用于处理 cookie
  • cache2 - 一个简单的 JavaScript 缓存管理,支持浏览器端和 node.js
  • store2 - 丰富了 localStorage 和 sessionStorage 功能(JSON,命名空间,扩展等)
  • dayjs - 一个轻量的处理时间和日期的 JavaScript 库,和 Moment.js 的 API 设计保持完全一样
  • date-fns - 提供了最全面、简单且一致的工具集,用于在浏览器和 Node.js 中操作 JavaScript 日期
  • moment - 一个轻量级 JavaScript 日期库,用于解析,验证,操作和格式化日期
  • ms - 将各种时间格式转换为毫秒
  • axios - 基于 Promise 的 HTTP 客户端,用于浏览器和 node.js
  • jsencrypt - 用于执行 OpenSSL RSA 加密,解密和密钥生成的 Javascript 库
  • crypto-js - 加密标准的 JavaScript 库
  • tinycolor2 - JavaScript 颜色工具,用于 JavaScript 中的颜色处理和转换
  • uuid - 生成通用唯一识别码(Universally Unique Identifier)
  • JSZip - 创建、读取和编辑 zip 文件
  • ua-parser-js - 用于从用户代理数据中检测浏览器、引擎、操作系统、CPU 和设备类型/型号