CoolFace
Datasetpublic

basant307/AI_Governance_Project

sourceHugging Faceapache-2.0updated 2mo agoView on Hugging Face
0likes48downloads
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 
basant307/AI_Governance_Project · CoolFace