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

armory9

v0.1.7

Published

工具组件库

Downloads

3

Readme

armory9

工具组件库基础模板

自动化生成方法

npm run new function

API 目录

加密方法

时间戳方法

操作dom元素

文档方法

普通方法

  • add 两数字相加

类型判断

本地缓存方法

正则校验

API 说明

timeToDate

时间戳转日期方法

 
 * timeToDate(1650764013237,{d: '天', h: '时', m: '分', s: '秒'}) => '2天6时55分21秒'
 

previewFile

预览文本(可扩展其他预览)


 * previewFile({url: 'http://xxx.xxx/xx.txt', type: 'txt'})
 

is

类型判断

 
 * is(参数, 类型)
 

isDef

不是 undefined

 
 * isDef('aaa') // true
 

isUnDef

是 undefined

 
 * isUnDef('aaa') // false
 

isObject

是否是 object 类型

 
 * isObject({}) // true
 

isEmpty

是否为空

 
 * isEmpty(1) // true
 

isDate

是否为 Date 类型

 
 * isDate(new Date) // true
 

isNull

是否为 null 类型

 
 * isNull(null) // true
 

isNullAndUnDef

是null和undefined

 
 * isNullAndUnDef
 

isNullOrUnDef

是null或undefined

 
 * isNullOrUnDef
 

isNumber

是否是 number 类型

 
 * isNumber(1) // true
 

isPromise

是否是 Promise 对象

 
 * isPromise(new Promise) // true
 

isString

是否是 string 类型

 
 * isString('') // true
 

isFunction

是否是 function 类型

 
 * isFunction(new Function) // true
 

isBoolean

是否是 boolean 类型

 
 * isBoolean(true) // true
 

isRegExp

是否是 regexp 类型

 
 * isRegExp(new RegExp) // true
 

isArray

是否是 array 类型

 
 * isArray([]) // true
 

isWindow

是否是 window 对象

 
 * isWindow(window) // true
 

isElement

是否是 element 元素

 
 * isElement(element) // true
 

isMap

是否是 Map 对象

 
 * isMap(new Map) // true
 

isUrl

是否是 url 路径

 
 * isUrl('https//') // true
 

isJson

是否是JSON

 
 * isJson('{}') // true
 

Encrypt

AES加密

 
 * Encrypt(参数1: 加密数据, 参数2: 密钥(长度必须16位), 参数3: 初始向量(长度随意))
 

Decrypt

AES解密

 
 * Encrypt(参数1: 加密数据, 参数2: 密钥(长度必须16位), 参数3: 初始向量(长度随意))
 

add

两数字相加

 
 * add(1, 2) => 3
 

Local

操作localStorage缓存

 
 * Local.set() // 设置永久缓存
 * Local.get() // 获取永久缓存
 * Local.remove() // 移除永久缓存
 * Local.clear() // 移除全部永久缓存
 

Session

操作session缓存

 
 * Session.set() // 设置session缓存
 * Session.get() // 获取session缓存
 * Session.remove() // 移除session缓存
 * Session.clear() // 移除全部永久缓存
 

Cookie

操作cookie缓存

 
 * Cookie.get() // 获取cookie缓存
 * Cookie.set() // 设置cookie缓存
 * Cookie.remove() // 删除cookie缓存
 

$

获取 dom 元素

 
 * $('#app') 
 

getWinW

获取浏览器宽度

 
 * getWinW
 

getWinH

获取浏览器高度

 
 * getWinH
 

hasClass

判断元素是否存在className

 
 * hasClass(dom元素, class名称)
 

addClass

给元素添加className

 
 * addClass(dom元素, class名称)
 

removeClass

删除元素className

 
 * removeClass(dom元素, class名称)
 

isvalidUsername

是否包含当前用户名

 
 * isvalidUsername("admin") => true
 

isEmail

邮箱格式

 
 * isEmail("[email protected]") => true
 

isMobile

手机号码验证

 
 * isMobilel('18402998114') => true
 

isPhone

电话号码验证

 
 * isPhone('029-1234567') => true
 

isLowerCasel

全部为小写字母

 
 * isLowerCasel('adsgagafg') => true
 

isUpperCasel

全部为大写字母

 
 * isUpperCasel('ASDSDG') => true
 

isAlphabetsl

全部为大小写混合字母

 
 * isAlphabetsl('adsaASEFDGFE') => true
 

isPc

验证pad还是pc,pad返回true,pc返回false

 
 * isPc('Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36') => true
 

isCardid

判断身份证号码

 
 * cardidl("610422199508232211") => true
 

isName

判断姓名是否正确

 
 * validatenamel("张三") => true
 

isInteger

判断是整数还是小数

 
 * isInteger(123) => true
 

isIP

判断是否是ip

 
 * isIP('123')
 

isChina

判断是否是中文

 
 * isChina('123') => false
 

isTel

判断是否是固定电话

 
 * isTel('123') => false