Skip to content

Commit 72f6fe2

Browse files
authored
Merge pull request #603 from FortAwesome/fix/safari-12-support
fix(browser-support): don't use string.replaceAll to fix safari 12 support
2 parents 463be70 + 1776e3a commit 72f6fe2

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

eslint.config.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ const config = tseslint.config(
7878
// `eslint-plugin-unicorn` rules
7979
'unicorn/no-keyword-prefix': 'off',
8080
'unicorn/no-null': 'off',
81+
'unicorn/prefer-string-replace-all': 'off', // Since FA still supports Safari 12, which doesn't support String.prototype.replaceAll
8182
'unicorn/prevent-abbreviations': 'off',
8283
},
8384
},

src/utils/camelize.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export function camelize(string: string): string {
2020
return string
2121
}
2222

23-
string = string.replaceAll(/[_-]+(.)?/g, (_: string, chr: string): string => {
23+
string = string.replace(/[_-]+(.)?/g, (_: string, chr: string): string => {
2424
return chr ? chr.toUpperCase() : ''
2525
})
2626

src/utils/get-class-list-from-props.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export function withPrefix(cls: string): string {
1616
config.cssPrefix || config.familyPrefix || DEFAULT_CLASSNAME_PREFIX
1717
return prefix === DEFAULT_CLASSNAME_PREFIX
1818
? cls
19-
: cls.replaceAll(
19+
: cls.replace(
2020
new RegExp(`(?<=^|\\s)${DEFAULT_CLASSNAME_PREFIX}-`, 'g'),
2121
`${prefix}-`,
2222
)

0 commit comments

Comments
 (0)