Created
March 11, 2018 23:16
-
-
Save diegohaz/6d7e2d4ef4d5dd450b5f1b361cacc597 to your computer and use it in GitHub Desktop.
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
const schema = require("schm"); | |
const exclaim = prevSchema => prevSchema.merge({ | |
parsers: { | |
exclaim: v => `${v}!!!`, | |
}, | |
}); | |
const userSchema = schema( | |
{ | |
name: { type: String, exclaim: true }, | |
age: Number, | |
}, | |
exclaim | |
); | |
userSchema.parse({ | |
name: "Haz", | |
age: 27, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment