aswi2020vldc-gitlab/templetes/node_modules/loader-utils/lib/getOptions.js @ ae1ff627
1 | 3a515b92 | cagy | 'use strict'; |
---|---|---|---|
2 | |||
3 | const parseQuery = require('./parseQuery'); |
||
4 | |||
5 | function getOptions(loaderContext) { |
||
6 | const query = loaderContext.query; |
||
7 | |||
8 | if (typeof query === 'string' && query !== '') { |
||
9 | return parseQuery(loaderContext.query); |
||
10 | }
|
||
11 | |||
12 | if (!query || typeof query !== 'object') { |
||
13 | // Not object-like queries are not supported.
|
||
14 | return null; |
||
15 | }
|
||
16 | |||
17 | return query; |
||
18 | }
|
||
19 | |||
20 | module.exports = getOptions; |