Skip to content
This repository has been archived by the owner on Jun 18, 2019. It is now read-only.

Commit

Permalink
fix: uses loaderUtils.getLoaderConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
mdreizin committed Jun 16, 2016
1 parent b4afc74 commit c2208b2
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import {
defaultsDeep,
cloneDeep,
merge,
kebabCase
} from 'lodash';
import properties from 'properties';
Expand All @@ -20,7 +18,7 @@ const DEFAULT_OPTIONS = {
* @private
* @type {String}
*/
const OPTIONS_PROPERTY = kebabCase('enhanced-properties');
const CONFIG_KEY = kebabCase('enhanced-properties');

/**
* @param {*} content
Expand All @@ -31,14 +29,12 @@ export default function(content) {
this.cacheable();
}

const query = loaderUtils.parseQuery(this.query),
globalOptions = this.options[query.config || OPTIONS_PROPERTY] || {},
localOptions = merge({}, cloneDeep(query), globalOptions),
const options = loaderUtils.getLoaderConfig(this, CONFIG_KEY),
callback = this.async();

defaultsDeep(localOptions, DEFAULT_OPTIONS);
defaultsDeep(options, DEFAULT_OPTIONS);

properties.parse(content, localOptions, (err, result = {}) => {
properties.parse(content, options, (err, result = {}) => {
callback(err, result);
});
}

0 comments on commit c2208b2

Please sign in to comment.