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

cmal-front-utils

v1.0.7

Published

collection of utility functions for CMAL

Downloads

55

Readme

cmal-front-utils

前端通用方法代码库

CMAL前端通用方法的代码库

创建说明

  • [ ] 仓库地址
  • [ ] 初始化npm包,通过npm init
  • [ ] 配置package.json和tsconfig.json文件
  • [ ] 编译TypeScript代码,运行命令npm run build
  • [ ] 发布到npm, 运行命令npm publish
  • [ ] 维护和更新, 更新版本号(使用npm version patch)和重新发布(npm publish

提供的方法 - 使用说明

1.initChart

初始化柱状图+折线图,基于Echarts

2.initPieChart

初始化饼图,基于Echarts

3.str_encode

js_base64 加密方法

4.str_encode

js_base64 解密方法

5.dateFormat

时间格式化方法,传入时间戳date和时间格式format参数

6.RandomUID

随机生成UID,用于登录验证码

7.setPublicKey

把公钥放到加密对象中

8.pwdEncrypt

密码进行加密

9.pwdEncrypt

密码进行加密

10.pwdEncrypt

密码进行加密

11.successMessage

返回成功消息提示,基于Element-Plus 2.7.x版

12.warnMessage

返回警告消息提示,基于Element-Plus 2.7.x版

13.errorMessage

返回失败消息提示,基于Element-Plus 2.7.x版

14.setMessageBox

弹出框提示, 基于Element-Plus 2.7.x版

15.encryptionCustom

自定义密码规则,参数传入pwd字段

16.encryptionCustom

自定义密码规则,参数传入pwd字段

17.encode

base64编码处理

18.clearValue

递归清空一个对象的所有值

19.getQueryVariable

获取url参数 大小写保持一致

20._GetMainUlr

获取ulr主域名

21.ObjectAssign

用于对象赋值对象,例如详情等

22.ObjectAssignB

对象赋值对象把对象B完全移植到A上

23.ArrayToEnum

将返回的数组转为对应的 枚举值enum

24.formatToTree

将一维数组对象转为tree格式方法

25.isEqualArray

用于比较两个数组是否相等,三个参数:mainArray(主数组)、secondaryArray(次要数组)和 strictMode(严格模式

26.cloneDeep

深拷贝

27.deletePropertyFromArrayObjects

删除指定数组对象的属性

28.deleteValueFromArrayObjects

删除指定数组对象中特定属性值和该属性名的元素

29.underscoreToCamelCase

将带有_下划线的字段命名转为驼峰命名

30.removeArrNullValue

消除数组对象里的空值

31.customNameDownloadDoc

前端自定义命名下载

32.findStatusEnum

获得字典数组, 返回可用的枚举键值对 对象

33.beforeUploadExcel

上传文件之前

34.conversionLong

处理java雪花id或长字符

npm version 与版本规范

  • 开发完成就可以给组件打上版本号了。

  • 按语义化版本控制规范 SemVer,版本格式为:major.minor.patch,版本号递增规则如下:

  • 主版本号 major:当你做了不兼容的 API 修改,

  • 次版本号 minor:当你做了向下兼容的功能性新增,

  • 修订号 patch:当你做了向下兼容的问题修正。

  • 先行版本号及版本编译信息可以加到“major.minor.patch”的后面,作为延伸。如:1.0.0-alpha.0

  • 每次发布前,需要确定一下更新的内容,选择版本号,使用 npm version 打上版本号

  $ npm version [patch|minor|major]
- ```

# 发布
1. 如果是开源, npm 官网注册账号;

2. 如果有内部的 npm 库,只需要找到 npm 管理人员给你添加即可;

3. 如果平时使用其他源,需要切换到 npm(可安装 nrm 来管理多个源):

```vue
$ nrm ls
 
  npm -------- https://registry.npmjs.org/
  yarn ------- https://registry.yarnpkg.com/
  cnpm ------- http://r.cnpmjs.org/
  taobao ----- https://registry.npm.taobao.org/
 
$ nrm use npm
  1. 在项目根目录下的命令行工具,运行npm login,会提示输入个人信息,完成登录

  2. 运行,上传

$ npm publish
  1. 如果上传过程顺利,没报红色错误信息,在 https://www.npmjs.com/ 就可以看到
  2. 发布的包在72小时内是可以删除的,过了72小时就永远无法删除了,所以记得不要随意发一些没有意义的包。如果需要卸载,在发布后72小时内执行:
 npm unpublish  <pkg>[@<version>]
 npm unpublish [email protected]