util.js 327 B

1234567891011121314
  1. /*
  2. * Misc functions
  3. */
  4. 'use strict'
  5. /**
  6. * @param {string} str
  7. * @returns {boolean} true if the given string contains non-BMP chars otherwise false
  8. */
  9. exports.containsNonBmpChars = function utilContainsNonBmpChars(str) {
  10. // check for first (high) surrogate in a non-BMP character
  11. return /[\uD800-\uDBFF]/.test(str)
  12. }