contains.js 323 B

123456789101112
  1. var getQuery = require('./getQuery');
  2. /**
  3. * Checks if query string contains parameter.
  4. */
  5. function contains(url, paramName) {
  6. var regex = new RegExp('(\\?|&)'+ paramName +'=', 'g'); //matches `?param=` or `&param=`
  7. return regex.test(getQuery(url));
  8. }
  9. module.exports = contains;