Message from JavaScript discussions

May 2017

— Ye

— 

// Logs an error message to console if boolean is false,
// If errorType is set, throws a new error of errorType instead.
function assert (boolean, message, errorType = null) {
if (!boolean) {
errorType !== null ? throw new errorType(message) : console.error(message);
}
}

— Oh god

— Assert = (val, str) => val || throw (str || val);

— There, message support

— I avoid short circuiting myself

— You may note my code is very verbose and laid out

— I write it like a book, haha

— WIP so far https://hastebin.com/axudivoson.js

— Kinda just a skeleton at the moment

— Oh man, you're definitely right

— I think has may function better as a type of indexOf instead