feat: move articles to the beginning of alias value

Closes #4
This commit is contained in:
Josh Sherman 2023-03-21 17:22:25 -05:00
parent 47b978b6a6
commit e4e3a3a449
No known key found for this signature in database
GPG key ID: 55B058A80530EF22

View file

@ -14,7 +14,7 @@ files.forEach((file) => {
// Awesome gist that inspired most of the following: // Awesome gist that inspired most of the following:
// https://gist.github.com/ramiabraham/ff41ba74f2b7104ecece // https://gist.github.com/ramiabraham/ff41ba74f2b7104ecece
const value = variable let value = variable
// Removes primary ROM codes // Removes primary ROM codes
.replace(/\[(a|p|b|f|T-|T+|t|h|o|J|!)\]/gi, '') .replace(/\[(a|p|b|f|T-|T+|t|h|o|J|!)\]/gi, '')
.replace(/\((-|M\d+|U|E|UE)\)/gi, '') .replace(/\((-|M\d+|U|E|UE)\)/gi, '')
@ -31,5 +31,17 @@ files.forEach((file) => {
// Removes Nintendo Entertainment System specific codes // Removes Nintendo Entertainment System specific codes
.replace(/\[(PC10|VS)\]/gi, ''); .replace(/\[(PC10|VS)\]/gi, '');
// Replaces suffixes with prefixes
// TODO: Needs to check if the suffix is at the end of the string or has a
// space after it, otherwise games like "Pong, Asteroids & Yars' Revenge"
// will be renamed to "A Pongsteroids & Yars' Revenge"
['A', 'The'].forEach((prefix) => {
const suffix = `, ${prefix}`;
if (value.includes(suffix)) {
value = `${prefix} ${value.replace(suffix, '')}`;
}
});
console.log(`${variable}=${value}`); console.log(`${variable}=${value}`);
}); });