* Applies fingerprint from the scope to the event if there's one, * uses message if there's one instead or get rid of empty fingerprint
(event: Event, fingerprint: ScopeData['fingerprint'] | undefined)
| 192 | * uses message if there's one instead or get rid of empty fingerprint |
| 193 | */ |
| 194 | function applyFingerprintToEvent(event: Event, fingerprint: ScopeData['fingerprint'] | undefined): void { |
| 195 | // Make sure it's an array first and we actually have something in place |
| 196 | event.fingerprint = event.fingerprint |
| 197 | ? Array.isArray(event.fingerprint) |
| 198 | ? event.fingerprint |
| 199 | : [event.fingerprint] |
| 200 | : []; |
| 201 | |
| 202 | // If we have something on the scope, then merge it with event |
| 203 | if (fingerprint) { |
| 204 | event.fingerprint = event.fingerprint.concat(fingerprint); |
| 205 | } |
| 206 | |
| 207 | // If we have no data at all, remove empty array default |
| 208 | if (!event.fingerprint.length) { |
| 209 | delete event.fingerprint; |
| 210 | } |
| 211 | } |
no outgoing calls
no test coverage detected