Created
April 10, 2024 06:57
-
-
Save KoenBrouwer/4b71adc8bb68a853ed835a65459db58a to your computer and use it in GitHub Desktop.
A script that i18n-ifies a word.
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 word = process.argv[2]; | |
// Shorten (s5n) the word like internationalization becomes i18n | |
const s5n = (word) => | |
word.length <= 2 ? word : [ | |
word.at(0), | |
word.length - 2, | |
word.at(-1), | |
].join(""); | |
console.log(s5n(word)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment