UNPKG

cjke-strings

Version:

a set of Chinese Japanese Korean and Emoji strings helpers

12 lines 401 B
import { readFirstCompleteChar } from './firstCompleteChar.js'; import { everything } from './base.js'; export function stringWidth(str, supports = everything) { let width = 0; while (str.length > 0) { const item = readFirstCompleteChar(str, supports); width += item.width; str = str.slice(item.length); } return width; } //# sourceMappingURL=stringWidth.js.map