Skip to content

Commit b95a30d

Browse files
mclackromainmenke
andauthored
Fix undefined is not a function for String.prototype.startsWith (#2568)
* Fix `undefined is not a function` for `String.prototype.startsWith` * Changelog entry added --------- Co-authored-by: Romain Menke <11521496+romainmenke@users.noreply.github.com>
1 parent d13ed53 commit b95a30d

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
- Update bugsnag-cocoa to [v6.33.1](https//github.com/bugsnag/bugsnag-cocoa/releases/tag/v6.33.1) [#2552](https://github.com/bugsnag/bugsnag-js/pull/2552)
2020
- Update bugsnag-android to [v6.18.0](https//github.com/bugsnag/bugsnag-android/releases/tag/v6.18.0) [#2556](https://github.com/bugsnag/bugsnag-js/pull/2556)
21+
- (core): Change `startsWith()` to `indexOf() === 0` to support older browsers [#2568](https://github.com/bugsnag/bugsnag-js/pull/2568)
2122

2223
### Fixed
2324

packages/core/client.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ class Client {
169169
// warn about an apikey that is not of the expected format
170170
if (!/^[0-9a-f]{32}$/i.test(config.apiKey)) errors.apiKey = 'should be a string of 32 hexadecimal characters'
171171

172-
if (opts.endpoints === undefined && config.apiKey.startsWith(HUB_PREFIX)) {
172+
if (opts.endpoints === undefined && config.apiKey.indexOf(HUB_PREFIX) === 0) {
173173
config.endpoints = {
174174
notify: HUB_NOTIFY,
175175
sessions: HUB_SESSION

0 commit comments

Comments
 (0)