Skip to content

Instantly share code, notes, and snippets.

@d3x0r
Last active November 27, 2019 08:41
Show Gist options
  • Save d3x0r/3345f4a5ff90ee7b346249a6cbfd414b to your computer and use it in GitHub Desktop.
Save d3x0r/3345f4a5ff90ee7b346249a6cbfd414b to your computer and use it in GitHub Desktop.
A routine to make a verb base into a present participle ... move -> moving
// This is a utility to make a pre-event dispatched before a normal event.
// on(move) ... on(moving... ) followed by on( move )
//
//
function makeIng( verb ) {
if( verb.endsWith( "y" )
||verb.endsWith( "a" )
||verb.endsWith( "o" )
|| verb.endsWith( "u" )
|| verb.endsWith( "w" ) ) {
// try -> trying
// scuba -> scubaing
// moto -> motoing
return verb + "ing";
} else if( verb.endsWith( "e" ) ) {
if( verb[verb.length-2] === 'i') {
// untie untying
return verb.substr(0,verb.length-2) + "ying";
}
// make -> making
// congrue ->congruing
return verb.substr(0,verb.length-1) + "ing";
} else {
// ram -> ramming
return verb + verb.substr(verb.length-1,1) + "ing";
}
}
/*
For two syllable verbs
If the 1st syllable is stressed, just add ING
answer - answering
offer - offering
listen - listening
visit - visiting
If the 2nd syllable is stressed , double the consonant and add ING
admit - admitting
prefer - preferring
begin - beginning
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment