foundryvtt-reve-de-dragon/module/grammar.js

18 lines
380 B
JavaScript
Raw Normal View History

2020-12-08 03:04:00 +01:00
const articlesApostrophes = {
'de' : 'd\'',
'le' : 'l\'',
'la' : 'l\''
}
export class Grammar {
static apostrophe(article, word) {
if (articlesApostrophes[article] && Grammar.startsWithVoyel(word)) {
return articlesApostrophes[article] + word
}
return article + ' ' + word;
}
static startsWithVoyel(word) {
return word.match(/^[aeiouy]/i)
}
}