Skip to content

Commit

Permalink
Make example directory more standalone (#1247)
Browse files Browse the repository at this point in the history
* Remove `is-email` from testing suite

* Add README and package.json to examples dir

* Remove is-uuid and is-url from root package.json

---------

Co-authored-by: Artur Müller <[email protected]>
  • Loading branch information
yeoffrey and arturmuller committed Jun 22, 2024
1 parent 625cea5 commit 88563ad
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 10 deletions.
3 changes: 3 additions & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Examples

To run the examples locally, first run `npm install` in this directory. Then use node to run any of the examples like so: `node basic-validation.js`, `node composing-structs.js`, etc.
10 changes: 10 additions & 0 deletions examples/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"type": "module",
"license": "MIT",
"dependencies": {
"is-email": "^1.0.2",
"is-url": "^1.2.4",
"is-uuid": "^1.0.2",
"superstruct": "latest"
}
}
3 changes: 0 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"is-email": "^1.0.0",
"is-url": "^1.2.4",
"is-uuid": "^1.0.2",
"lodash": "^4.17.15",
"np": "^10.0.0",
"prettier": "^3.2.5",
Expand Down
3 changes: 0 additions & 3 deletions test/@types/is-email.d.ts

This file was deleted.

3 changes: 1 addition & 2 deletions test/validation/refine/invalid.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import isEmail from 'is-email'
import { string, refine } from '../../../src'

export const Struct = refine(string(), 'email', isEmail)
export const Struct = refine(string(), 'email', (value) => value.includes('@'))

export const data = 'invalid'

Expand Down
3 changes: 1 addition & 2 deletions test/validation/refine/valid.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import isEmail from 'is-email'
import { string, refine } from '../../../src'

export const Struct = refine(string(), 'email', isEmail)
export const Struct = refine(string(), 'email', (value) => value.includes('@'))

export const data = '[email protected]'

Expand Down

0 comments on commit 88563ad

Please sign in to comment.