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