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