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

fshows-utils-tool

v1.0.27

Published

## 使用

Downloads

17

Readme

fsUtilsTool utils工具方法集合

使用

安装

npm install fshows-utils-tool --save

demo

import Utils from 'fshows-utils-tool'

Utils.checkPhone('12121') // 检测手机号

方法

base

checkPhone, // 检测是否为电话号码
isTel, // 检测电话号码(包括座机号和手机号)
isInteger, // 是否是正整数
isNumber, // 是否是数字
isSpecial, // 校验特殊字符
isFeePoint, // 校验小数点后最多几位
checkPwd, // 检测密码格式 6-16位数字或字母
checkPwd2, // 检测密码格式 6-16位数字和字母
checkMinaAppId, // 校验appid
validateLowerCase, // 是否是小写字母
validateUpperCase, // 是否是大写字母
validateAlphabets, // 大小写字母
limitOnlyNumLetter, // 只能输入数字字母字符
limitNumber, // 只能输入数字
keepTwoNumber, // 保留小数点后两位
isEmpty, // 是否为空
isIdcard, // 身份证是否合法
filterEmoji, // 替换ios中的emoji表情
onlyNumberEnglish, // 替换除英文,数字以外的字符
checkLength, // 检测字符串长度
checkRealLength, // 检测字符串真实长度,字符占一位,中文占两位
isChina, // 检测是否是中文
replaceSpace, // 替换空格
validateHexColor, // 校验色值
getSuffix, // 获取文件后缀
percentageConversion, // 将小数数值换算成百分比字符串
validateLoginPassword, // 须包含大小写字母和数字的默认8-20位
getType, // 判断数据类型
commafy, // 数字每千位加逗号
hideMobile // 手机号码中间4位隐藏花号(*)显示
checkEmoj, // 校验输入框中是否有emoji表情
replaceEmoj // 替换输入框中的emoji表情

time

transitionTimestamp, // 时间戳转时间
getBeforeMonthDate, // 获取n个月前的日期
getBeforeDayDate, // 获取n个天前的日期
getAfterDayDate // 获取n个天后的日期

object

objArryDeepCopy, // 对象数组的深拷贝
getObjectOriginalValue, // 只复制原对象有的属性
compareObject, // 比较两个对象是否相同
isObjEmpty, // 判断对象内是否有为空的属性
extend, // 合并对象到目标对象
getUrlQueryObj, // 解析url中的参数
debounce, // 节流
throttle // 节流

browser

isWxBrowser, // 判断是否是微信浏览器
isAliBrowser, // 判断是否是支付宝浏览器
judgeDeviceType, // 判断是android还是ios
mobileVersion // 判断手机是android 还是 ios

storeage

数据存储需要注意

Utils.local调用的是storage的存贮获取,

Utils.session调用的是session的存贮获取 方法都是相同的

getItem, // 获取值
setItem, // 存值
removeItem, // 移除值
clear //清除存储

加减乘除运算

建议使用 lodash
参考链接:https://www.lodashjs.com/