-
-
Notifications
You must be signed in to change notification settings - Fork 0
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
72bf4ba
commit aa0c8d9
Showing
1 changed file
with
30 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 |
---|---|---|
|
@@ -307,11 +307,41 @@ The following methods will call `s.string` with additional constraints added: | |
after1994('07/04/1989'); // ERROR | ||
``` | ||
* s.uuidString | ||
```javascript | ||
const schema = s.uuidString(); | ||
s.parse(schema, '0ff5d941-f46a-4f4a-aec8-1d1ec117e2a3'); // '0ff5d941-f46a-4f4a-aec8-1d1ec117e2a3' | ||
s.parse(schema, '0ff5d941'); // ERROR | ||
``` | ||
* s.urlString | ||
```javascript | ||
const schema = s.urlString(); | ||
s.parse(schema, 'https://example.com'); // 'https://example.com' | ||
s.parse(schema, 'not a url'); // ERROR | ||
``` | ||
* s.emailString | ||
```javascript | ||
const schema = s.emailString(); | ||
s.parse(schema, '[email protected]'); // 'https://example.com' | ||
s.parse(schema, 'not an email'); // ERROR | ||
``` | ||
* s.regexString | ||
```javascript | ||
const schema = s.emailString(); | ||
s.parse(schema, '.+?'); // 'https://example.com' | ||
s.parse(schema, '+++'); // ERROR | ||
``` | ||
* s.base64String | ||
```javascript | ||
const schema = s.base64String(); | ||
s.parse(schema, 'RXhhbXBsZSBzdHJpbmc='); // 'RXhhbXBsZSBzdHJpbmc='; | ||
s.parse(schema, 'notbase64'); // ERROR; | ||
``` | ||
* s.jsonString | ||
```javascript | ||
const schema = s.jsonString(); | ||
s.parse(schema, '[0, 1, 2]'); // '[0, 1, 2]'; | ||
s.parse(schema, 'not json'); // ERROR; | ||
``` | ||
|
||
</details> | ||
|
||
|