loader-utils
Advanced tools
Comparing version 0.2.15 to 0.2.16
19
index.js
@@ -68,3 +68,3 @@ var JSON5 = require("json5"); | ||
if(typeof query !== "string") | ||
throw new Error("parseQuery should get a string as first argument"); | ||
return query; | ||
if(query.substr(0, 1) !== "?") | ||
@@ -110,12 +110,11 @@ throw new Error("a valid query string passed to parseQuery should begin with '?'"); | ||
exports.getLoaderConfig = function(loaderContext, defaultConfigKey) { | ||
if (!defaultConfigKey) { | ||
throw new Error("Default config key missing"); | ||
} | ||
var query = exports.parseQuery(loaderContext.query); | ||
var configKey = query.config || defaultConfigKey; | ||
var config = loaderContext.options[configKey] || {}; | ||
if (configKey) { | ||
var config = loaderContext.options[configKey] || {}; | ||
delete query.config; | ||
return assign({}, config, query); | ||
} | ||
delete query.config; | ||
return assign({}, config, query); | ||
return query; | ||
}; | ||
@@ -144,2 +143,4 @@ | ||
exports.getRemainingRequest = function(loaderContext) { | ||
if(loaderContext.remainingRequest) | ||
return loaderContext.remainingRequest; | ||
var request = loaderContext.loaders.slice(loaderContext.loaderIndex+1).map(dotRequest).concat([loaderContext.resource]); | ||
@@ -150,2 +151,4 @@ return request.join("!"); | ||
exports.getCurrentRequest = function(loaderContext) { | ||
if(loaderContext.currentRequest) | ||
return loaderContext.currentRequest; | ||
var request = loaderContext.loaders.slice(loaderContext.loaderIndex).map(dotRequest).concat([loaderContext.resource]); | ||
@@ -152,0 +155,0 @@ return request.join("!"); |
{ | ||
"name": "loader-utils", | ||
"version": "0.2.15", | ||
"version": "0.2.16", | ||
"author": "Tobias Koppers @sokra", | ||
@@ -5,0 +5,0 @@ "description": "utils for webpack loaders", |
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
282
11700
3
1
0