Using unprint for Perv City . Updated unprint for date formats.

This commit is contained in:
DebaucheryLibrarian
2026-01-10 23:07:03 +01:00
parent f04451f746
commit c9ba7bb90b
7 changed files with 142 additions and 93 deletions

View File

@@ -59,11 +59,23 @@ function kgToLbs(kgs) {
return Math.round(Number(kilos) / 0.453592);
}
function curateConvertInput(string) {
if (/[']|(fe*t)/.test(string)) {
const result = string.match(/(\d+).*(\d+)/);
if (result) {
return `${result[1]}ft ${result[2]}in`;
}
}
return string;
}
function convertManyApi(input, to) {
const curatedInput = input
.replace(/[']\s*/, 'ft ') // ensure 1 space
.replace(/["”]|('')/, 'in') // 54”
.replace(/\d+ft\s*\d+\s*$/, (match) => `${match}in`); // height without any inch symbol
const curatedInput = curateConvertInput(input);
console.log('CONVERT', input);
console.log('RESULT', curatedInput);
return Math.round(convertMany(curatedInput).to(to)) || null;
}