-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathucd-0.2.0.min.js
9 lines (8 loc) · 1.13 KB
/
ucd-0.2.0.min.js
1
2
3
4
5
6
7
8
9
/*
UCD offers a series of functions that provide a simple
interface to the Unicode Character Database.
Released under the MIT license.
Copyright (c) 2013 ynakajima <[email protected]>
*/
(function(f){var g="undefined"!==typeof require?require("../data/unicodedata.js"):f.UnicodeData,b={getName:function(a){var c=a.charCodeAt(0);"undefined"===typeof b.characterNameList&&b.readUnicodeData(g);55296<=c&&56319>=c&&(a=a.charCodeAt(1),c=(c-55296<<10)+(a-56320)+65536);a=b.characterNameList[c];return"undefined"!==typeof a?a:"undefined"},getUnicodeVersion:function(){"undefined"===typeof b.characterNameList&&b.readUnicodeData(g);return b.unicodeVersion},readUnicodeData:function(a){b.unicodeVersion=
a.unicodeVersion;for(var c=[],h=0,f=a.characterNameList.length;h<f;h++){var d=a.characterNameList[h].split(";");if(2<=d.length){var e=parseInt(d[0],16),d=d[1];if(-1!==d.indexOf(", First>"))for(var g=parseInt(a.characterNameList[++h].split(";")[0],16),d=d.replace(/, First>$/,"").replace(/^</,"");e<=g;e++){var k=e.toString(16).toUpperCase();c[e]=d+"-"+k}else c[e]=d}}b.characterNameList=c}};"undefined"!==typeof module?module.exports=b:f.UCD=b})(this);