Skip to content

Instantly share code, notes, and snippets.

View DMGithinji's full-sized avatar
💯
Never Settle

DMG DMGithinji

💯
Never Settle
View GitHub Profile
export function Unscrambler(list: string[]) {
// helper functions
const firstChar = (str: string) => str.charAt(0);
const secondChar = (str: string) => str.charAt(1);
const lastChar = (str: string) => str.charAt(str.length - 1);
const secondLastChar = (str: string) => str.charAt(str.length - 2);
const hasFirst = (str: string): boolean => firstChar(str) === '_';
const hasLast = (str: string): boolean => str.slice(-1) === '_';