basant307/AI_Governance_Project
048
1import {getCategory, isAmbiguous, isFullWidth, isWide} from './lookup.js';2 3function validate(codePoint) {4 if (!Number.isSafeInteger(codePoint)) {5 throw new TypeError(`Expected a code point, got \`${typeof codePoint}\`.`);6 }7}8 9export function eastAsianWidthType(codePoint) {10 validate(codePoint);11 12 return getCategory(codePoint);13}14 15export function eastAsianWidth(codePoint, {ambiguousAsWide = false} = {}) {16 validate(codePoint);17 18 if (19 isFullWidth(codePoint)20 || isWide(codePoint)21 || (ambiguousAsWide && isAmbiguous(codePoint))22 ) {23 return 2;24 }25 26 return 1;27}28 29// Private exports for https://github.com/sindresorhus/is-fullwidth-code-point30export {isFullWidth as _isFullWidth, isWide as _isWide} from './lookup.js';31 