Skip to content

Commit

Permalink
Fix issue Nuklon#222
Browse files Browse the repository at this point in the history
Make it more elegant
  • Loading branch information
SeRi0uS007 committed Aug 20, 2024
1 parent 15489b5 commit c6a87b2
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions code.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -2566,16 +2566,11 @@
}
}

function getPriceValueAsInt(listing) {
// Match number part from any currency format
const results = listing.match(/\d[0-9 .,]*(\.|,\d{0,2})?/gm);

if (results == null) {
return 0;
}

return unsafeWindow.GetPriceValueAsInt(results[0]);
}
// Match number part from any currency format
const getPriceValueAsInt = listing =>
unsafeWindow.GetPriceValueAsInt(
listing.match(/(?<price>[0-9][0-9 .,]*)/)?.groups?.price ?? 0
);

const marketListingsQueue = async.queue((listing, next) => {
marketListingsQueueWorker(
Expand Down

0 comments on commit c6a87b2

Please sign in to comment.