valid.js 326 B

12345678910111213
  1. 'use strict'
  2. const Range = require('../classes/range')
  3. const validRange = (range, options) => {
  4. try {
  5. // Return '*' instead of '' so that truthiness works.
  6. // This will throw if it's invalid anyway
  7. return new Range(range, options).range || '*'
  8. } catch (er) {
  9. return null
  10. }
  11. }
  12. module.exports = validRange