From c295a27f5240ea3b7ca9b8ec5c449a42db02b798 Mon Sep 17 00:00:00 2001 From: Donald Pipowitch Date: Mon, 20 Mar 2017 12:40:06 +0100 Subject: [PATCH 1/2] fixed #20 --- index.js | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/index.js b/index.js index 58639ef..10cfb6a 100644 --- a/index.js +++ b/index.js @@ -1,13 +1,13 @@ var _ = require('lodash'); -var utils = require('loader-utils'); +var loaderUtils = require('loader-utils'); -function processQuery(source, query) { - if (!_.isUndefined(query.search) && !_.isUndefined(query.replace)) { - if (!_.isUndefined(query.flags)) { - query.search = new RegExp(query.search, query.flags); +function processOptions(source, options) { + if (!_.isUndefined(options.search) && !_.isUndefined(options.replace)) { + if (!_.isUndefined(options.flags)) { + options.search = new RegExp(options.search, options.flags); } - source = source.replace(query.search, query.replace); + source = source.replace(options.search, options.replace); } return source; @@ -16,14 +16,14 @@ function processQuery(source, query) { module.exports = function (source) { this.cacheable(); - var query = utils.parseQuery(this.query); + var options = loaderUtils.getOptions(this); - if (_.isArray(query.multiple)) { - query.multiple.forEach(function (subquery) { - source = processQuery(source, subquery); + if (_.isArray(options.multiple)) { + options.multiple.forEach(function (suboptions) { + source = processOptions(source, suboptions); }); } else { - source = processQuery(source, query); + source = processOptions(source, options); } return source; From 66fb7c50064242eea790edc2915cc87da8b9232f Mon Sep 17 00:00:00 2001 From: Donald Pipowitch Date: Mon, 20 Mar 2017 12:40:57 +0100 Subject: [PATCH 2/2] fixed #20 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b50ee26..0ac06aa 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ }, "main": "index.js", "dependencies": { - "loader-utils": "^0.2.11", + "loader-utils": "^1.1.0", "lodash": "^3.10.1" }, "devDependencies": {