parse-options.js 338 B

1234567891011121314151617
  1. 'use strict'
  2. // parse out just the options we care about
  3. const looseOption = Object.freeze({ loose: true })
  4. const emptyOpts = Object.freeze({ })
  5. const parseOptions = options => {
  6. if (!options) {
  7. return emptyOpts
  8. }
  9. if (typeof options !== 'object') {
  10. return looseOption
  11. }
  12. return options
  13. }
  14. module.exports = parseOptions