0.2.1 • Published 6 years ago

n-validator v0.2.1

Weekly downloads
1
License
ISC
Repository
github
Last release
6 years ago

n-validator

codecov

前提:目前前端 mock, 只做了 url & method 校验。

这种情况下,前端几乎不太会去关心接口 具体参数 的格式,所以,前端的自测,一般在 mock 环境下通过,就算是通过了。但是跟后端联调各种格式问题。

所以,想在前端 mock 环境下,搞一套类似 静态类型检查 的东西,初始生成 mock 数据的时候,就定好 参数格式规则 ,省去前后端联调时再去 订正 数据格式的时间,提高效率。

Validator

MethodDescription
isInt(str, , options)check if the variable is an integer.
isFloat(str, , options)check if the variable is a float.
isDate(str, , options)check if the string is a date string.
isDateTime(str, , options)check if the string is a date-time string.
isBoolean(val, , options)check if the variable is a boolean.
isLength(str, , options)check if the string's length falls in a range. ( min, max )
isRequired(str)check if the variable required.

todo

  • isFloat, decimal digits(0.10: 2?1)
  • number strictMode
  • date stamp
0.2.1

6 years ago

0.2.0

6 years ago

0.1.8

6 years ago

0.1.7

6 years ago

0.1.6

6 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago

0.0.1

6 years ago