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

itjs

v1.0.5

Published

itjs is the data type validation data support promise

Readme

itjs

itjs , assert type | get the data type | validation data

support

nodejs
>ie5
chrome
firefox 
...
有些接口未验证 , 理论支持 , 如发现bug 请提交issue

install

npm install -S itjs

api && example

var it = require('itjs')
console.log(it._version_)
console.log(it._name_) 

it.scope() 
it.interface('add',function(){})
it.assign({},{})
/** cookie */
it.cookie()
it.cookie.defaults={}
it.cookie.expiresMultiplier=60 * 60 * 24 //天
it.cookie.expiresMultiplier=60 * 60 //小时 
it.cookie.get() //获得指定的cookie
it.cookie.set() //设置指定的cookie
it.cookie.setDefault() // 没有设置过的cookie 才设置 , 不然跳过
it.cookie.remove() // 删除指定的cookie
it.cookie.empty() // 将清空所有的cookie值
var allCookie =  it.cookie.all()
console.log(allCookie) //{}
var cookieEnabled = it.cookie.enabled() 
console.log(cookieEnabled) // true/false
/** cookie */
var countdown = it.countdown(20)
console.log(countdown.status)
var endCountDown = countdown(function(wait){
  console.log(wait)
  console.log(countdown.status)
})
console.log(countdown.status)
endCountDown()
it.decode()
it.each([],function(){})
it.each({},function(){})
it.find([],function(){})
it.encode()
it.event.on(document.body,'click',function(){})
it.event.off(document.body,'click',function(){})
it.event.fire(document.body,'click')
it.hasOwnProperty({name:'itjs'},'name')
it.keys({name:'itjs',version:'1.0.0'})
it.offset.getOffset()
it.offset.getPageArea()
it.offset.getScroll()
it.offset.getCoords()
it.opener('http://www.google.com')
var _new = it.opener.async('http://www.google.com')
_new()
it.safe.get()
it.safe.set()
it.strLength('这个是itjs')//10
it.trim('  itjs  ')//itjs
it.type('itjs')//string
it.type([])//array
it.type({})//object
it.type(true)//boolean
it.type(/-/)//regexp
...

/**是否是 函数参数集合 */
it.is.arguments(value: any): boolean
/**是否是 数组 */
it.is.array(value: any): boolean
/**是否是 对象 */
it.is.object(value: any): boolean
/**是否是 布尔 */
it.is.boolean(value: any): boolean
/**是否是 时间 */
it.is.date(value: any): boolean
/**是否是 数字 */
it.is.number(value: any): boolean
/**是否是 函数 */
it.is.function(value: any): boolean
/**是否是 错误 */
it.is.error(value: any): boolean
/**是否是 正则 */
it.is.regexp(value: any): boolean
/**是否是 字符串 */
it.is.string(value: any): boolean
/**是否是 undefined */
it.is.undefined(value: any): boolean
/**是否是 null */
it.is.null(value: any): boolean
/**是否是 window */
it.is.window(obj: object): boolean
/**是否是 nan */
it.is.nan(value: any): boolean
/**是否是 空 */
it.is.empty(value: any): boolean
/**是否是 存在 */
it.is.exist(value: any): boolean
/**是否是 element */
it.is.element(value: any): boolean
/**是否是 相同的 */
it.is.same(value: any, other: any): boolean
/**是否是 相同的类型 */
it.is.sameType(value: any, other: any): boolean
/**是否能匹配 value待匹配的字符串 , rex为正则表达式 */
it.is.pattern(value: any, rex: RegExp): boolean
/**最小字符串长度*/
it.is.minStrLength(value: string, length: number): boolean
/**最大字符串长度  */
it.is.maxStrLength(value: string, length: number): boolean
/**字符串长度  */
it.is.strLength(value: string, length: number): boolean
/**是否是 字母 */
it.is.alpha(value: string): boolean
/**是否是 字母数字 */
it.is.alphaNum(value: string): boolean
/**是否是 数字 */
it.is.digits(value: string | number): boolean
/**是否是 正整数 */
it.is.positive(value: string | number): boolean
/**是否是 整数 */
it.is.integer(value: string | number): boolean
/**是否是 url */
it.is.url(value: string): boolean
/**是否是 email */
it.is.email(value: string): boolean
/**是否是 hexColor */
it.is.hexColor(value: string): boolean
/**是否是 ipv6 */
it.is.ipv6(value: string): boolean
/**是否是 ipv4 */
it.is.ipv4(value: string): boolean
/**是否是 ip */
it.is.ip(value: string): boolean
/**是否是 idNo */
it.is.idNo(value: string | number): boolean
/**是否是 qq */
it.is.qqNo(value: string | number): boolean
/**是否是 phone */
it.is.phone(value: string | number): boolean
/**是否是 chinese */
it.is.chinese(value: string): boolean
/**是否是 zipCode */
it.is.zipCode(value: string | number): boolean
/**是否是 设备 ie */
it.is.ie(range: '>${<number>version}' | '>=${<number>version}' | '<${<number>version}' | '<=${<number>version}' | number): boolean
/**是否是 设备 edge */
it.is.edge(range: '>${<number>version}' | '>=${<number>version}' | '<${<number>version}' | '<=${<number>version}' | number): boolean
/**是否是 设备 chrome */
it.is.chrome(range: '>${<number>version}' | '>=${<number>version}' | '<${<number>version}' | '<=${<number>version}' | number): boolean
/**是否是 设备 firefox */
it.is.firefox(range: '>${<number>version}' | '>=${<number>version}' | '<${<number>version}' | '<=${<number>version}' | number): boolean
/**是否是 设备 opera */
it.is.opera(range: '>${<number>version}' | '>=${<number>version}' | '<${<number>version}' | '<=${<number>version}' | number): boolean
/**是否是 设备 safari */
it.is.safari(range: '>${<number>version}' | '>=${<number>version}' | '<${<number>version}' | '<=${<number>version}' | number): boolean
/**是否是 设备 iphone */
it.is.iphone(range: '>${<number>version}' | '>=${<number>version}' | '<${<number>version}' | '<=${<number>version}' | number): boolean
/**是否是 设备 ipod */
it.is.ipod(range: '>${<number>version}' | '>=${<number>version}' | '<${<number>version}' | '<=${<number>version}' | number): boolean
/**是否是 设备 ipad */
it.is.ipad(range: '>${<number>version}' | '>=${<number>version}' | '<${<number>version}' | '<=${<number>version}' | number): boolean
/**是否是 设备 ios */
it.is.ios(): boolean
/**是否是 设备 uc */
it.is.uc(): boolean
/**是否是 设备 wx */
it.is.wx(): boolean
/**是否是 设备 qq */
it.is.qq(): boolean
/**是否是 设备 tt */
it.is.tt(): boolean
/**是否是 设备 se360 */
it.is.se360(): boolean
/**是否是 设备 baidu */
it.is.baidu(): boolean
/**是否是 设备 aoyou */
it.is.aoyou(): boolean
/**是否是 设备 android */
it.is.android(): boolean
/**是否是 设备 androidPhone */
it.is.androidPhone(): boolean
/**是否是 设备 androidTablet */
it.is.androidTablet(): boolean
/**是否是 设备 blackberry */
it.is.blackberry(): boolean
/**是否是 设备 windowsPhone */
it.is.windowsPhone(): boolean
/**是否是 设备 windowsTablet */
it.is.windowsTablet(): boolean
/**是否是 设备 windows */
it.is.windows(): boolean
/**是否是 设备 mac */
it.is.mac(): boolean
/**是否是 设备 linux */
it.is.linux(): boolean
/**是否是 设备 pc */
it.is.pc(): boolean
/**是否是 设备 mobile */
it.is.mobile(): boolean
/**是否是 设备 tablet */
it.is.tablet(): boolean
/**是否是 设备 online */
it.is.online(): boolean
/**是否是 设备 offline */
it.is.offline(): boolean
/**是否是 设备 touchDevice */
it.is.touchDevice(): boolean