@technobuddha/library
Version:
A large library of useful functions
17 lines (16 loc) • 540 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.unicodeLength = void 0;
var constants_1 = require("../constants");
/**
* Return the number of unicode code points in a string
*
* @param input the unicode string
* @returns the number of code points
*/
function unicodeLength(input) {
// eslint-disable-next-line require-unicode-regexp
return input.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, constants_1.space).length;
}
exports.unicodeLength = unicodeLength;
exports.default = unicodeLength;