drawrowfly / amazon-product-api

Amazon Scraper. Scrape products from the amazon search result or reviews from the specific product
648 stars 187 forks source link

chore: Refactor price_format function in constant.js #126

Open asimchoudhary opened 3 months ago

asimchoudhary commented 3 months ago

In current implementation of the price_format function within constant.js . I encountered an issue when the input price does not match the expected pattern. Specifically, the price.match(/.*\$([0-9.]+)/) expression returns undefined for inputs that do not contain the pattern. This leads to a subsequent error when attempting to access the length property of undefined in the line if (formatedPrice.length > 0).