Last active
December 12, 2023 12:54
-
-
Save treuks/59d9259874da452f005993ab9fd8f161 to your computer and use it in GitHub Desktop.
prepend.js
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
class InvalidString extends Error { | |
constructor(message, cause) { | |
super(message); | |
this.cause = cause; | |
this.name = "InvalidString" | |
} | |
} | |
const main = () => { | |
const text = args.join(" "); | |
if (!text.includes("<~~")) { | |
throw new InvalidString("The message supplied to prepend does not contain <~~"); | |
} | |
const splitText = text.split("<~~"); | |
return `${splitText[1]}${splitText[0]}`; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment