sr-npm 1.7.242 → 1.7.244

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sr-npm",
3
- "version": "1.7.242",
3
+ "version": "1.7.244",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -348,21 +348,34 @@ async function handleLocationParam(_$w,location) {
348
348
  async function updateMapMarkers(_$w){
349
349
  const numOfItems = await _$w('#jobsDataset').getTotalCount();
350
350
  const items = await _$w('#jobsDataset').getItems(0, numOfItems);
351
- const markers = items.items.map(item => {
352
- const location = item.locationAddress.location;
353
- return {
354
- location: {
355
- latitude: location.latitude,
356
- longitude: location.longitude
357
- },
358
- address: item.locationAddress.formatted,
359
- title: item.title,
360
- };
361
- });
351
+ const markers = items.items
352
+ .filter(item => {
353
+ const locationAddress = item.locationAddress;
354
+ const location = locationAddress && locationAddress.location;
355
+ return (
356
+ location !== undefined &&
357
+ location !== null &&
358
+ location.latitude !== undefined &&
359
+ location.latitude !== null &&
360
+ location.longitude !== undefined &&
361
+ location.longitude !== null
362
+ );
363
+ })
364
+ .map(item => {
365
+ const location = item.locationAddress.location;
366
+ return {
367
+ location: {
368
+ latitude: location.latitude,
369
+ longitude: location.longitude
370
+ },
371
+ address: item.locationAddress.formatted,
372
+ title: item.title
373
+ };
374
+ });
362
375
  console.log("markers: ", markers);
363
376
  console.log("type of markers: ", typeof markers);
364
377
  //@ts-ignore
365
- _$w('#googleMaps').setMarkers(markers);
378
+ await _$w('#googleMaps').setMarkers(markers);
366
379
  let getmarkers2=await _$w('#googleMaps').markers;
367
380
  console.log("getmarkers2: ", getmarkers2);
368
381