getOptions.js 400 B

123456789101112131415161718192021
  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 null;
  11. }
  12. return query;
  13. }
  14. module.exports = getOptions;