more advanced unit aliasing
This commit is contained in:
parent
921e9df04e
commit
32c041cb4f
@ -43,7 +43,7 @@
|
||||
},
|
||||
{
|
||||
"name": "utility",
|
||||
"version": "3.1.7"
|
||||
"version": "3.1.10"
|
||||
}
|
||||
],
|
||||
"typescript": true
|
||||
|
@ -2,7 +2,7 @@
|
||||
"main": "plugin.js",
|
||||
"name": "utility",
|
||||
"description": "Utility commands and math operations",
|
||||
"version": "3.1.7",
|
||||
"version": "3.1.10",
|
||||
"tags": ["commands", "tools"],
|
||||
"dependencies": ["simplecommands"],
|
||||
"npmDependencies": [
|
||||
|
@ -236,10 +236,12 @@ function createUnitIndex(): void {
|
||||
abbr, singular.toLowerCase(), plural.toLowerCase()
|
||||
];
|
||||
|
||||
// liter <-> litres
|
||||
if (abbr === 'l') {
|
||||
unitIndex[abbr].push('liter', 'liters');
|
||||
}
|
||||
|
||||
// meter -> metre
|
||||
if (singular.includes('meter')) {
|
||||
unitIndex[abbr].push(
|
||||
singular.replace('meter', 'metre').toLowerCase(),
|
||||
@ -247,6 +249,23 @@ function createUnitIndex(): void {
|
||||
);
|
||||
}
|
||||
|
||||
// metre -> meter
|
||||
if (singular.includes('metre')) {
|
||||
unitIndex[abbr].push(
|
||||
singular.replace('metre', 'meter').toLowerCase(),
|
||||
plural.replace('metre', 'meter').toLowerCase(),
|
||||
);
|
||||
}
|
||||
|
||||
// " per " -> "/"
|
||||
const appendages: string[] = [];
|
||||
unitIndex[abbr].forEach((entry) => {
|
||||
if (entry.includes(' per ')) {
|
||||
appendages.push(entry.replace(' per ', '/'));
|
||||
}
|
||||
});
|
||||
unitIndex[abbr].push(...appendages);
|
||||
|
||||
backupLowercaseUnitTable[abbr.toLowerCase()] = abbr;
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user