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.

13 lines
449 B

4 years ago
  1. /**
  2. * @author Toru Nagashima <https://github.com/mysticatea>
  3. */
  4. "use strict";
  5. /**
  6. * Check whether a given character is a combining mark or not.
  7. * @param {number} codePoint The character code to check.
  8. * @returns {boolean} `true` if the character belongs to the category, any of `Mc`, `Me`, and `Mn`.
  9. */
  10. module.exports = function isCombiningCharacter(codePoint) {
  11. return /^[\p{Mc}\p{Me}\p{Mn}]$/u.test(String.fromCodePoint(codePoint));
  12. };