UNPKG

bajo

Version:

A framework to build a giant monstrous app rapidly

23 lines (21 loc) 753 B
function shim () { // taken from: https://vanillajstoolkit.com/polyfills/stringreplaceall/ if (!String.prototype.replaceAll) { String.prototype.replaceAll = function(str, newStr) { // eslint-disable-line if (Object.prototype.toString.call(str).toLowerCase() === '[object regexp]') { return this.replace(str, newStr) } return this.replace(new RegExp(str, 'g'), newStr) } } if (!String.prototype.splice) { String.prototype.splice = function(index, count, add) { // eslint-disable-line if (index < 0) { index += this.length if (index < 0) index = 0 } return this.slice(0, index) + (add || '') + this.slice(index + count) } } } export default shim