UNPKG

dsw

Version:

Dynamic Service Worker, offline Progressive Web Apps much easier

15 lines (12 loc) 344 B
const utils = { applyMatch (matching, text) { if (matching && matching.length > 1 && text) { // we apply the variables matching.forEach(function(cur, idx){ text = text.replace(new RegExp('\\$' + idx, 'i'), cur); }); } return text; } }; export default utils;