Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[No QA] Add polyfill for replaceAll() to fix Safari iOS 13 #447

Merged
merged 3 commits into from
May 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions lib/str.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint-disable no-control-regex */
import _ from 'underscore';
import {AllHtmlEntities} from 'html-entities';
import replaceAll from 'string.prototype.replaceall';
import {CONST} from './CONST';

const Str = {
Expand Down Expand Up @@ -1049,6 +1050,18 @@ const Str = {
isDomainEmail(email) {
return this.startsWith(email, '+@');
},

/**
* Polyfill for String.prototype.replaceAll
*
* @param {String} text
* @param {String|RegExp} searchValue
* @param {String|Function} replaceValue
* @returns {String}
*/
replaceAll(text, searchValue, replaceValue) {
techievivek marked this conversation as resolved.
Show resolved Hide resolved
return replaceAll(text, searchValue, replaceValue);
},
};

export default Str;
Loading