@hudk/assert
v0.1.0
Published
assert for hudk
Downloads
3
Readme
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()
- equal(o)
- isNull()
- isUndefined()
- isUndefinedOrNull()
- isEmptyOrNull()
- isZeroOrNull()
- isEmptyOrZeroOrNull()
- isStr() : is string or not
- isNum()
- isNaturalNum()
- isPosInt() : is postive int or not
- lengthShorterThan(length)
- lengthLongerThan(length)
- followReg(pattern) : user pattern for test, for example,
expect(obj).followReg(/^\d+?$/)
is equal to theexpect(obj).isNaturalNum()