Created
January 17, 2018 19:58
-
-
Save marcusstenbeck/9c687040ede4c4c2481e1bf66a29bf16 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 max50 = str => str.length <= 50; | |
module.exports = function addShow({ title, time, host, location }) { | |
if (!title || !max50(title)) { | |
throw new Error(`title can't be longer than 50 characters`); | |
} | |
if (!(time instanceof Date)) { | |
throw new Error(`time must be a date object`); | |
} | |
if (!host || !max50(host)) { | |
throw new Error(`host can't be longer than 50 characters`); | |
} | |
if (!location || !max50(location)) { | |
throw new Error(`location can't be longer than 50 characters`); | |
} | |
// Data good ... Save a ShowAdded event | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment