UNPKG

atikin-bug-storyteller

Version:

CLI tool that transforms error messages into funny stories. Developed by Atikin Verse.

31 lines (25 loc) 929 B
const funnyOpenings = [ "Once upon a bug,", "In a faraway codebase,", "Legend says,", "Deep in the stack trace," ]; const funnyTwists = [ "the variables danced out of sync.", "the function forgot its purpose.", "the compiler wept softly.", "the developer's coffee went cold." ]; const funnyEndings = [ "And thus, the bug was born.", "Moral of the story: always lint.", "Perhaps tomorrow, the bug will rest.", "And they debugged happily ever after." ]; function transformErrorToStory(errorMsg) { const opening = funnyOpenings[Math.floor(Math.random() * funnyOpenings.length)]; const twist = funnyTwists[Math.floor(Math.random() * funnyTwists.length)]; const ending = funnyEndings[Math.floor(Math.random() * funnyEndings.length)]; return `${opening} "${errorMsg}", ${twist} ${ending}`; } module.exports = { transformErrorToStory };