Skip to content

Present / Past Tense conversion #129

Closed Answered by samhatoum
samhatoum asked this question in Help on coding
Discussion options

You must be logged in to vote

inspired by your approach, and with the help of ChatGPT I ended up doing this, which is good enough for now. So thanks!

function capitalizeFirstLetter(word: string): string {
  return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
}

function removeCommandSuffix(str: string): string {
  return str.endsWith('Command') ? str.slice(0, -7) : str;
}

type IrregularVerb = [string, string];
const irregularVerbs: IrregularVerb[] = [
  ['arise', 'arisen'],
  ['awake', 'awoken'],
  ['be', 'been'],
  ['bear', 'borne'],
  ['beat', 'beaten'],
  ['become', 'become'],
  ['begin', 'begun'],
  ['bend', 'bent'],
  ['bet', 'bet'],
  ['bid', 'bidden'],
  ['bind', 'bound'],
  ['bite', 'bitten'],
  [

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@sanjayaksaxena
Comment options

Answer selected by sanjayaksaxena
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants