This repository has been archived by the owner on Jan 8, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
830d2a7
commit 1fbcab1
Showing
2 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
|
||
 | ||
|
||
[](https://travis-ci.org/github/oslllo/validator-exception) | ||
[](https://www.npmjs.com/package/oslllo-validator-exception) | ||
[](https://coveralls.io/github/oslllo/validator-exception?branch=master) | ||
|
||
## Documentation, Installation, and Usage Instructions | ||
|
||
> This package is a wrapper for [oslllo-validator](https://www.npmjs.com/package/oslllo-validator) therefore share the same documentaion with it. | ||
See the full installation and usage documentation [HERE](https://docs.oslllo.com/validator/master/). | ||
|
||
## The Objective | ||
|
||
Create an all in one Javascript validator that throws an `exception` on `false`. | ||
|
||
## The Problem / Why This Was Created | ||
|
||
It was requested [HERE](https://github.com/oslllo/validator/issues/2) | ||
|
||
### Usage Examples | ||
|
||
#### Check if value is actual NaN | ||
|
||
```js | ||
const assert = require("oslllo-validator-exception"); | ||
|
||
assert.actualNaN(NaN); // => True | ||
assert.actualNaN(null); // => Throws Error | ||
assert.actualNaN(undefined); // => Throws Error | ||
``` | ||
|
||
#### Check if value is actual NaN but throw an exception with a custom message on `false` | ||
|
||
```js | ||
const assert = require("oslllo-validator-exception"); | ||
|
||
assert.actualNaN(null, assert.msg("Invalid UUID")); // => Throws Error with custom message "Invalid UUID" | ||
|
||
``` | ||
|
||
--- |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.