optionsMatches.cjs 729 B

1234567891011121314151617181920212223242526
  1. // NOTICE: This file is generated by Rollup. To modify it,
  2. // please instead edit the ESM counterpart and rebuild with Rollup (npm run build).
  3. 'use strict';
  4. const matchesStringOrRegExp = require('./matchesStringOrRegExp.cjs');
  5. /**
  6. * Check if an options object's propertyName contains a user-defined string or
  7. * regex that matches the passed in input.
  8. *
  9. * @param {{ [x: string]: any; }} options
  10. * @param {string} propertyName
  11. * @param {unknown} input
  12. *
  13. * @returns {boolean}
  14. */
  15. function optionsMatches(options, propertyName, input) {
  16. return Boolean(
  17. options &&
  18. options[propertyName] &&
  19. typeof input === 'string' &&
  20. matchesStringOrRegExp(input, options[propertyName]),
  21. );
  22. }
  23. module.exports = optionsMatches;