Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 47ed4e6

Browse files
committed
Remove spaces in templated strings
1 parent 9ceb567 commit 47ed4e6

1 file changed

Lines changed: 3 additions & 9 deletions

File tree

subaru.js

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,8 @@ function parseResults(body, dealer) {
77
const cars = [];
88
const content = cheerio.load(body);
99
const dealerName = content('.org').text().trim();
10-
const dealerAddress = `\
11-
${content('.street-address').text().trim()}, \
12-
${content('.locality').text().trim()}, \
13-
${content('.region').text().trim()}, \
14-
${content('.postal-code').text().trim()}`;
15-
const dealerCityState = `\
16-
${content('.locality').text().trim()}, \
17-
${content('.region').text().trim()}`;
10+
const dealerAddress = `${content('.street-address').text().trim()}, ${content('.locality').text().trim()}, ${content('.region').text().trim()}, ${content('.postal-code').text().trim()}`;
11+
const dealerCityState = `${content('.locality').text().trim()}, ${content('.region').text().trim()}`;
1812
const numCars = content('.vehicle-count').last().text();
1913
if (!numCars || numCars === '0') return cars;
2014
content('.hproduct', '.bd').each(
@@ -116,7 +110,7 @@ async function run() {
116110
</tr>`;
117111

118112
for (const car of allCars) {
119-
const googleMapsLink = `https://www.google.com/maps/place/${car.dealerAddress.replace(' ', '+')}`;
113+
const googleMapsLink = `https://www.google.com/maps/place/${car.dealerAddress.replace(/\s/g, '+')}`;
120114
html += `<tr>
121115
<td><img src="${car.imgUrl}" width="120px"></td>
122116
<td>${car.msrp}</td>

0 commit comments

Comments
 (0)