From 419c2274a680ca31634ab49b45647ab50c645285 Mon Sep 17 00:00:00 2001 From: sashless Date: Fri, 13 Nov 2015 14:40:06 +0100 Subject: [PATCH] can pass an array of search & replace options --- index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 91b2f74..6c0f1dd 100644 --- a/index.js +++ b/index.js @@ -5,11 +5,11 @@ module.exports = function (source) { var query = utils.parseQuery(this.query); if (typeof query.search !== 'undefined' && typeof query.replace !== 'undefined') { - if (typeof query.flags !== 'undefined') { - query.search = new RegExp(query.search, query.flags); - } + for(var i = 0; i < query.length; i++){ + var option = query[i]; - source = source.replace(query.search, query.replace); + source = source.replace(option.search, option.replace); + } } return source;