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 🙏

© 2025 – Pkg Stats / Ryan Hefner

decent-utils

v1.0.16

Published

鼎信前端工具类

Downloads

41

Readme

使用

npm i -S decent-utils (or) yarn add decent-utils -S 
import utils from 'decent-utils'  
console.log(utils.arrJudge(['1','2']))

arr.js 15

| 方法名 | 作用 | 参数 | 返回值 | 版本 | | :----------------- | :----------------------------------------------------------- | :----------------------------------------------------------- | :-------------------------- | :----- | | arrJudge | 判断是否是数组 | arr | Boolean 值 | 1.0.0 | | arrRemoveRepeat | 移除数组中重复的项 | arr | Array,处理的数组值 | 1.0.0 | | arrOrderAscend | 数组排序 | arr | Array,处理的数组值 | 1.0.0 | | arrMax | 数组中最大值 | arr | Array,处理的数组值 | 1.0.0 | | arrSum | 数组求和 | arr | Array,处理的数组值 | 1.0.0 | | arrObjSum | 数组对象求和 | arr | Array,处理的数组值 | 1.0.1 | | arrConcat | 数组合并 | arrOne:数组一;arrTwo:数组二 | Array,处理的数组值 | 1.0.0 | | arrIncludeValue | 数组中是否包含某值 | arr: 数组; value: 判断的值 | Array,处理的数组值 | 1.0.0 | | arrAndSet | 数组并集 | arrOne:数组一;arrTwo:数组二 | Array,处理的数组值 | 1.0.0 | | arrIntersection | 数组交集 | arrOne:数组一;arrTwo:数组二 | Array,处理的数组值 | 1.0.0 | | arrDifference | 数组差集 | arrOne:数组一;arrTwo:数组二 | Array,处理的数组值 | 1.0.0 | | arrTwoToArrObj | 数组合并成对象数组 | arrOne:数组一;arrTwo:数组二;oneKey:属性一(选传);twoKey:属性一(选传) | Array,处理的数组值 | 1.0.0 | | toTree | 将一维数组转换成树形格式(仅适用于目前的路由权限数据格式 1.0.16 版本之后不推荐使用) | data:后台返回的路由数据 | Array,处理后的数据 | 1.0.5 | | treeForeachBreadth | 树形广度遍历 | tree:遍历的数据,func:回调函数,children子节点名称(默认"children") | - | 1.0.11 | | treeForeachDepth | 树形深度遍历 | tree:遍历的数据,func:回调函数,children子节点名称(默认"children") | - | 1.0.11 | | treeFilter | 树形结构过滤 | tree:遍历的数据,func:过滤条件,children子节点名称(默认"children") | - | 1.0.12 | | listToTree | 将一维数组转换成树形格式 | data:遍历的数据,key:主键的key(默认为id),pidKey:层级关系父级元素的key(默认为parentId),_childrenKey:树形结构子集key(默认为children) | Array,处理后的树形结构数据 | 1.0.16 | | treeToList | 树形结构转为一维数组(扁平化) | data:遍历的树形结构数据,_childrenKey:树形结构子集key(默认为children) | Array,处理后的一维数组数据 | 1.0.16 |

  • 备注:目前数组相关工具类只支持一维数组

check.js 11

| 方法名 | 作用 | 参数 | 返回值 | 版本 | | :----------------------- | :-------------------------- | :-------------- | :--------- | :---- | | checkNum | 判断是否是数字 | data: 判断的值 | Boolean 值 | 1.0.0 | | checkLetter | 判断是否是数字 | data | Boolean 值 | 1.0.0 | | checkLowercaseLetter | 判断是否全部是小写字母 | data | Boolean 值 | 1.0.0 | | checkCapitalLetter | 判断是否是大写字母 | data | Boolean 值 | 1.0.0 | | checkNumOrLetter | 判断是否是字母或数字 | data | Boolean 值 | 1.0.0 | | checkChinese | 判断是否是中文 | data | Boolean 值 | 1.0.0 | | checkChineseNumberLetter | 判断是否是中文,数字或字母 | data | Boolean 值 | 1.0.0 | | checkEmail | 判断是否是邮箱 | data | Boolean 值 | 1.0.0 | | checkTelephone | 判断是否是手机号 | data | Boolean 值 | 1.0.0 | | checkUrl | 判断是正确的网址 | data | Boolean 值 | 1.0.0 | | luhnCheck | luhn(模10算法) 银行卡号校验 | str:处理字符; | Boolean | 1.0.4 | | checkCardId | 判断是否是身份证 | str:处理字符; | Boolean | 1.0.5 |

client.js 4

| 方法名 | 作用 | 参数 | 返回值 | 版本 | | :------------------ | :---------------------- | :--- | :---------------------------------------------------------------- | :---- | | checkBrowser | 判断浏览器 | - | trident:IE;presto:opera;webKit:苹果、谷歌内核;gecko:火狐; | 1.0.0 | | checkIosAndroidIpad | 判断客户端类型 | - | ios:ios;android:android;iPad:iPad; | 1.0.0 | | checkWeixinQqUc | 判断微信,qq 或uc | - | weixin:微信; qq:qq;uc:uc; | 1.0.0 | | checkIsIphoneX | 判断是否是 iPhoneX 序列 | - | Boolean | 1.0.0 |

file.js 2

| 方法名 | 作用 | 参数 | 返回值 | 版本 | | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----------------- | :--------------------------------------------------------------------------------------------------- | :------------------------------ | :----- | | fileFormatSize | 格式化文件单位 | size | String: 处理后的文件数字和单位 | 1.0.0 | | downloadFile