Compare commits

...

1 Commits

Author SHA1 Message Date
orangecoding
53d5098cec fixing wrong number extraction 2025-11-03 20:01:55 +01:00
3 changed files with 5 additions and 4 deletions

View File

@@ -8,7 +8,7 @@ function normalize(o) {
const title = o.title || 'No title available'; const title = o.title || 'No title available';
const link = o.link != null ? decodeURIComponent(o.link) : config.url; const link = o.link != null ? decodeURIComponent(o.link) : config.url;
var urlReg = new RegExp(/url\((.*?)\)/gim); const urlReg = new RegExp(/url\((.*?)\)/gim);
const image = o.image != null ? urlReg.exec(o.image)[1] : null; const image = o.image != null ? urlReg.exec(o.image)[1] : null;
return Object.assign(o, { id, address, title, link, image }); return Object.assign(o, { id, address, title, link, image });
} }

View File

@@ -152,8 +152,9 @@ export const storeListings = (jobId, providerId, listings) => {
*/ */
function extractNumber(str) { function extractNumber(str) {
if (!str) return null; if (!str) return null;
const match = str.replace(/[.,]/g, '').match(/\d+/); const cleaned = str.replace(/\./g, '').replace(',', '.');
return match ? +match[0] : null; const num = parseFloat(cleaned);
return isNaN(num) ? null : num;
} }
/** /**

View File

@@ -1,6 +1,6 @@
{ {
"name": "fredy", "name": "fredy",
"version": "14.3.2", "version": "14.3.3",
"description": "[F]ind [R]eal [E]states [d]amn eas[y].", "description": "[F]ind [R]eal [E]states [d]amn eas[y].",
"scripts": { "scripts": {
"prepare": "husky", "prepare": "husky",