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

xiaohuwei

v0.0.5

Published

前端公用方法集合,持续更新.....

Downloads

6

Readme

大多数方法来源于网络收集,和平时项目中自己写的。

使用

npm i -S xiaohuwei  
import xiaohuwei from 'xiaohuwei'  
console.log(xiaohuwei.arrJudge(['1','2']))

arr.js

备注:目前数组相关工具类只支持一维数组
|方法名|作用|参数|返回值| |--|--|--|--| |arrJudge|判断是否是数组|Boolean 值|arr| |arrRemoveRepeat|移除数组中重复的项|arr|Array,处理的数组值| |arrOrderAscend|数组排序|arr|Array,处理的数组值| |arrMax|数组中最大值|arr|Array,处理的数组值| |arrSum|数组求和|arr|Array,处理的数组值| |arrObjSum|数组对象求和|arr|Array,处理的数组值| |arrConcat|数组合并|arrOne:数组一;arrTwo:数组二|Array,处理的数组值| |arrIncludeValue|数组中是否包含某值|arr: 数组; value: 判断的值|Array,处理的数组值| |arrAndSet|数组并集|arrOne:数组一;arrTwo:数组二|Array,处理的数组值| |arrIntersection|数组交集|arrOne:数组一;arrTwo:数组二|Array,处理的数组值| |arrDifference|数组差集|arrOne:数组一;arrTwo:数组二|Array,处理的数组值| |arrTwoToArrObj|数组合并成对象数组|arrOne:数组一;arrTwo:数组二;oneKey:属性一(选传);twoKey:属性一(选传)|Array,处理的数组值|

check.js

|方法名|作用|参数|返回值| |--|--|--|--| |checkNum|判断是否是数字|data: 判断的值|Boolean 值| |checkLetter|判断是否是数字|data|Boolean 值| |checkLowercaseLetter|判断是否全部是小写字母|Boolean 值|data| |checkCapitalLetter|判断是否是大写字母|data|Boolean 值| |checkNumOrLetter|判断是否是字母或数字|data|Boolean 值| |checkChinese|判断是否是中文|data|Boolean 值| |checkChineseNumberLettter|判断是否是中文,数字或字母|Boolean 值|data| |checkEmail| 判断是否是邮箱|Boolean 值| data| |checkTelphone|判断是否是手机号|Boolean 值|data| |checkUrl| 判断是正确的网址| data|Boolean 值|

client.js

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

file.js

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

obj.js

|方法名|作用|参数|返回值|版本| |--|--|--|--|--| |objIsEqual|判断两个对象是否相等| oneObj:对象一;twoObj:对象二;| Boolean| 1.2.0| |objDeepClone|对象深度拷贝| obj:克隆的对象;| obj:克隆后的对象;| 1.2.0|

storage.js

|方法名|作用|参数|返回值| |--|--|--|--| |localStorageSet|localStorage 存贮| key:存贮属性;value:存贮属性值;| -| |localStorageGet|localStorage 获取| key:获取属性;|存贮属性值| |localStorageRemove|localStorage 删除| key:删除属性;| -| |localStorageSetExpire|localStorage 存贮一段时间| key:存贮属性;value:存贮属性值;expire:有效期,单位毫秒;| -| |sessionStorageSet|sessionStorageSet 存贮| key:存贮属性;value:存贮属性值;| -| |sessionStorageGet|sessionStorage 获取| key:获取属性;| 存贮属性值| |sessionStorageRemove|sessionStorage 删除| key:删除属性;| -| |sessionStorageSetExpire|sessionStorage 存贮一段时间| key:存贮属性;value:存贮属性值;expire:有效期,单位毫秒;| -| |cookieSet|cookieSet 存贮一段时间| key:存贮属性;value:存贮属性值;expire:有效期,单位天;| -| |cookieGet|cookie 获取| key:获取属性;| 存贮的属性值| |cookieRemove|cookie 删除| key:删除属性;| -|

str.js

|方法名|作用|参数|返回值| |--|--|--|--| |strTrimLeftOrRight|去除字符左右空格| str:处理字符;|处理后的字符| |strInclude|字符是否包含| str:处理字符;value:需要判断的值;| Boolean| |strBeginWith| 字符是否以某一字符开头| str:处理字符;value:需要判断的值;|Boolean| |strReplace|字符替换成另一字符| str:处理字符;valueOne:需要替换的值;valueTwo:替换后的值;|处理后的字符| |strToCapital| 字符全部转化成大写| str:处理字符;|处理后的字符| |strToLowercase| 字符全部转化成小写| str:处理字符;|处理后的字符| |strToCapitalLetter| 字符转化成以大写开头| str:处理字符;|处理后的字符|

thrDeb.js

|方法名|作用|参数|返回值| |--|--|--|--| |throttle|节流|func:处理函数;delay:延时;|执行函数| |debounce|防抖|func:处理函数;delay:延时;|执行函数|

time.js

|方法名|作用|参数|返回值| |--|--|--|--| |getYear|获取当前年份|-|年份值| |getMonth|获取当前月份|-|月份值| |getDay|获取当前日|-|日值| |getWhatDay|获取当前星期几|-|星期几| |getMonthNum|获取当前月份天数|-|月份天数值| |getYyMmDdHhMmSs|获取当前时间|-|当前时间:yyyy-mm-dd,hh:mm:ss| |timesToYyMmDd|时间戳转化为年月日|times:时间戳;ymd:格式类型,值可为yyyy-mm-dd,yyyy/mm/dd;hms:时分秒,值可为;hh,hh:mm,hh:mm:ss|处理后的年月日| |YyMmDdToTimes|年月日转化成时间戳|yyyy/mm/dd 或yyyy-mm-dd 或yyyy-mm-dd hh:mm 或yyyy-mm-dd hh:mm:ss|时间戳| |compareTimeOneLessTwo|比较时间一小于二|timeOne:时间一;timeTwo:时间二;| Boolean|

url.js

|方法名|作用|参数|返回值| |--|--|--|--| |getQueryString|获取路由传参| name:传参属性|属性值|