Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cevek/assertio
Tiny assertion lib with typescript plugin to remove all assertations on production
https://github.com/cevek/assertio
Last synced: 5 days ago
JSON representation
Tiny assertion lib with typescript plugin to remove all assertations on production
- Host: GitHub
- URL: https://github.com/cevek/assertio
- Owner: cevek
- License: mit
- Created: 2019-07-04T15:23:37.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-07T07:29:15.000Z (almost 2 years ago)
- Last Synced: 2024-11-01T02:34:54.168Z (about 2 months ago)
- Language: TypeScript
- Size: 743 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Assertio
Assertio is a tiny assertion library, similar to Node's built-in assert.
It makes testing much easier by giving you lots of assertions you can run against your code.## Assertations
* `assert(value: boolean, msg?)`
* `assertValue(value, predicate, msg?)`
* `assertFn(value: () => boolean, msg?)`
* `ensureArray(value, msg?)`
* `ensureObject(value, msg?)`
* `ensureString(value, msg?)`
* `ensureNumber(value, msg?)`
* `ensureBoolean(value, msg?)`
* `ensureNonVoid(value, msg?)`
* `ensureNonNull(value, msg?)`
* `ensureNonNullable(value, msg?)`
* `nonVoid(value, msg?)`
* `nonNull(value, msg?)`
* `nonNullable(value, msg?)`
* `never(msg?)`
* `neverValue(value, msg?)`
* `castValue(value)`
* `cast(value)`
* `as(value)`
* `maybe(value)`## TypeScript transformer plugin
Assertio has a typescript transformer plugin to remove all assertations on production.
See how to use typescript plugins https://github.com/cevek/ttypescript`tsconfig.json`
```
{
"compilerOptions": {
// ...
"plugins": [
{ "transform": "assertio/transform" },
]
}
}
```