is.js是一个强大的通用js表单验证工具类。你可以使用js.js来检测任何东西,例如检测所给的值是否为参数,是否是数组,是否是超链接,...,甚至可以检测浏览器类型,正则表达式和数学表达式等等。
is.js根据检测的类型分为:类型检测、正则表达式检测、算数检测、环境检测、时间检测、Presence检测、对象检测、字符串检测数组检测和配置检测。
下面是is.js所有可以检测的内容:
Type
- arguments
- array
- boolean
- date
- error
- function
- nan
- null
- number
- object
- regexp
- string
- char
- undefined
- sameType
Presence
- empty
- existy
- truthy
- falsy
- space
RegExp
- url
- creditCard
- alphaNumeric
- timeString
- dateString
- usZipCode
- caPostalCode
- ukPostCode
- nanpPhone
- eppPhone
- socialSecurityNumber
- affirmative
- hexadecimal
- hexColor
- ip
- ipv4
- ipv6
String
- include
- upperCase
- lowerCase
- startWith
- endWith
- capitalized
Arithmetic
- equal
- even
- odd
- positive
- negative
- above
- under
- within
- decimal
- integer
- finite
- infinite
Object
- propertyCount
- propertyDefined
- windowObject
Array
- inArray
- sorted
Environment
- ie
- chrome
- firefox
- opera
- safari
- ios
- iphone
- ipad
- ipod
- android
- androidPhone
- androidTablet
- blackberry
- windowsPhone
- windowsTablet
- windows
- mac
- linux
- desktop
- mobile
- tablet
- online
- offline
Time
- today
- yesterday
- tomorrow
- past
- future
- day
- month
- year
- weekday
- weekend
- inDateRange
- inLastWeek
- inLastMonth
- inLastYear
- inNextWeek
- inNextMonth
- inNextYear
- quarterOfYear
- dayLightSavingTime
Configuration
- setRegexp
- setNamespace
使用方法
详细的使用方法前参看这里:is.js使用方法