0.1.0 • Published 6 years ago
@hudk/assert v0.1.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()
- 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()
0.1.0
6 years ago