Typescript type testing and validation library. See API for all methods provided.
The @fireflysemantics/is
library declares @fireflysemantics/validatorts
as a peer dependency.
Therefore both libraries must be installed by your application.
npm i -S @fireflysemantics/validatorts
npm i -S @fireflysemantics/is
Note that if you are using the `FESM5` package format the `tslib` peer dependency must also be installed.
npm i -S npm i tslib
# Supported Package Formats
The library is built with the Angular Package Format. It therefore supports all these package formats (As can be seen in the provided `package.json`) and has integrated typescript definitions:
- "main": "bundles/fireflysemantics-validatorts.umd.js",
- "module": "fesm5/fireflysemantics-validatorts.js",
- "es2015": "fesm2015/fireflysemantics-validatorts.js",
- "esm5": "esm5/fireflysemantics-validatorts.js",
- "esm2015": "esm2015/fireflysemantics-validatorts.js",
- "fesm5": "fesm5/fireflysemantics-validatorts.js",
- "fesm2015": "fesm2015/fireflysemantics-validatorts.js",
- "typings": "fireflysemantics-validatorts.d.ts"
## Typedoc
[Typedoc](https://fireflysemantics.github.io/is/doc/)
## Build
Run `ng build is` to build the project. The build artifacts will be stored in the `dist/` directory.
## Publishing
After building your library with `ng build is`, go to the dist folder `cd dist/is` and run `npm publish`.
## Blog
- [Application Central Nervous System](https://medium.com/@ole.ersoy/application-central-nervous-system-37aba8e5e899)
- [Angular Application Central Nervous System Brain](https://medium.com/@ole.ersoy/angular-application-nervous-system-brain-685a684f357)
## Usage
We use this library to implement the validation decorators in [@fireflysemantics/validator](https://www.npmjs.com/package/@fireflysemantics/validator). The functions can also be used to add semantic meaning to your test cases using [NPM Assert](https://www.npmjs.com/package/assert) or Jest and the same goes for general boolean logic in your source code.
For example instead of:
```ts
import { ok } from "assert";
ok(decorator != null, "The decorator is not null or undefined");
Use:
import { ok } from "assert";
import {isDefined} from "@fireflysemantics/is";
ok(isDefined(decorator));
See the test cases. For additional detail also see the validator.js test cases.
Run npm t
to execute the unit tests via Jest.
To get more help on the Angular CLI use ng help
or go check out the Angular CLI README.