parse-options.js 401 B

1234567891011
  1. // parse out just the options we care about so we always get a consistent
  2. // obj with keys in a consistent order.
  3. const opts = ['includePrerelease', 'loose', 'rtl']
  4. const parseOptions = options =>
  5. !options ? {}
  6. : typeof options !== 'object' ? { loose: true }
  7. : opts.filter(k => options[k]).reduce((options, k) => {
  8. options[k] = true
  9. return options
  10. }, {})
  11. module.exports = parseOptions