Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

_hasUnicode.js 949B

1234567891011121314151617181920212223242526
  1. /** Used to compose unicode character classes. */
  2. var rsAstralRange = '\\ud800-\\udfff',
  3. rsComboMarksRange = '\\u0300-\\u036f',
  4. reComboHalfMarksRange = '\\ufe20-\\ufe2f',
  5. rsComboSymbolsRange = '\\u20d0-\\u20ff',
  6. rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
  7. rsVarRange = '\\ufe0e\\ufe0f';
  8. /** Used to compose unicode capture groups. */
  9. var rsZWJ = '\\u200d';
  10. /** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */
  11. var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
  12. /**
  13. * Checks if `string` contains Unicode symbols.
  14. *
  15. * @private
  16. * @param {string} string The string to inspect.
  17. * @returns {boolean} Returns `true` if a symbol is found, else `false`.
  18. */
  19. function hasUnicode(string) {
  20. return reHasUnicode.test(string);
  21. }
  22. module.exports = hasUnicode;