npm.io
0.1.0 • Published 8 years ago

@hudk/assert

Licence
ISC
Version
0.1.0
Deps
0
Size
3 kB
Vulns
0
Weekly
0

assert

a simple assert library for params test

usage

npm install @hudk/assert

import { expect } from '@hudk/assert'
expect(obj).isNull()

api

expect

expect(obj).api()
  1. equal(o)
  2. isNull()
  3. isUndefined()
  4. isUndefinedOrNull()
  5. isEmptyOrNull()
  6. isZeroOrNull()
  7. isEmptyOrZeroOrNull()
  8. isStr() : is string or not
  9. isNum()
  10. isNaturalNum()
  11. isPosInt() : is postive int or not
  12. lengthShorterThan(length)
  13. lengthLongerThan(length)
  14. followReg(pattern) : user pattern for test, for example, expect(obj).followReg(/^\d+?$/) is equal to the expect(obj).isNaturalNum()

Keywords