Skip to content

Commit

Permalink
make sure products is an array before .map()
Browse files Browse the repository at this point in the history
  • Loading branch information
ad-astra-via committed Jun 18, 2024
1 parent 36905c0 commit 9427245
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@ const getECParams = (event: MCEvent) => {
payload.name ||
payload.product_id ||
payload.sku ||
Array.isArray(payload.products)
(Array.isArray(payload.products)
? payload.products.map((p: any) => p.name).join()

Check warning on line 31 in src/index.ts

View workflow job for this annotation

GitHub Actions / build-test (18.x)

Unexpected any. Specify a different type
: ''
: '')

data.ev = payload.price || payload.total || payload.value
data.gv = payload.price || data.gv
break
Expand Down

0 comments on commit 9427245

Please sign in to comment.