Skip to content

Commit 7956a45

Browse files
bluwyQix-
authored andcommitted
Avoid using deprecated RegExp.$1
1 parent 5464bdd commit 7956a45

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/browser.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,14 +125,16 @@ function useColors() {
125125
return false;
126126
}
127127

128+
let m;
129+
128130
// Is webkit? http://stackoverflow.com/a/16459606/376773
129131
// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
130132
return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
131133
// Is firebug? http://stackoverflow.com/a/398120/376773
132134
(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
133135
// Is firefox >= v31?
134136
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
135-
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
137+
(typeof navigator !== 'undefined' && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31) ||
136138
// Double check webkit in userAgent just in case we are in a worker
137139
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
138140
}

0 commit comments

Comments
 (0)