getOptions.js 398 B

1234567891011121314151617181920
  1. 'use strict';
  2. const parseQuery = require('./parseQuery');
  3. function getOptions(loaderContext) {
  4. const query = loaderContext.query;
  5. if (typeof query === 'string' && query !== '') {
  6. return parseQuery(loaderContext.query);
  7. }
  8. if (!query || typeof query !== 'object') {
  9. // Not object-like queries are not supported.
  10. return {};
  11. }
  12. return query;
  13. }
  14. module.exports = getOptions;