hasPrefix.cjs 499 B

12345678910111213141516171819
  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 prefixes = require('../reference/prefixes.cjs');
  5. const HAS_PREFIX_REGEX = new RegExp(`(?:${[...prefixes.prefixes].join('|')})`, 'i');
  6. /**
  7. * Check if a string contains any prefix
  8. *
  9. * @param {string} string
  10. * @returns {boolean}
  11. */
  12. function hasPrefix(string) {
  13. return HAS_PREFIX_REGEX.test(string);
  14. }
  15. module.exports = hasPrefix;