democratic-csi/src/utils/polyfills.js

10 lines
287 B
JavaScript

if (typeof String.prototype.replaceAll == "undefined") {
String.prototype.replaceAll = function (match, replace) {
return this.replace(new RegExp(match, "g"), () => replace);
};
}
Array.prototype.random = function () {
return this[Math.floor(Math.random() * this.length)];
};