2021-04-10 08:16:12 +08:00
|
|
|
// parse out just the options we care about so we always get a consistent
|
|
|
|
// obj with keys in a consistent order.
|
|
|
|
const opts = ['includePrerelease', 'loose', 'rtl']
|
|
|
|
const parseOptions = options =>
|
|
|
|
!options ? {}
|
|
|
|
: typeof options !== 'object' ? { loose: true }
|
2022-10-17 18:03:20 +08:00
|
|
|
: opts.filter(k => options[k]).reduce((o, k) => {
|
|
|
|
o[k] = true
|
|
|
|
return o
|
2021-04-10 08:16:12 +08:00
|
|
|
}, {})
|
|
|
|
module.exports = parseOptions
|