UNPKG

mew-time

Version:
30 lines (23 loc) 698 B
import MewTime from "./mewtime/mewtime"; import MEWTIME_CONST from "./constant/mewtime.const"; const VERSION = "0.0.1"; function mewtime(date) { return new MewTime(date); } mewtime.version = VERSION; mewtime.const = MEWTIME_CONST; mewtime.isMewTime = instance => { return instance instanceof MewTime; }; /** * 32개의 십육진수(8-4-4-4-12)로 이루어진 유니크한 키를 반환한다. * @returns {string} */ mewtime.uuid = () => { return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, match => { const r = Math.random() * 16 | 0; const v = match === "x" ? r : (r & 0x3) | 0x8; return v.toString(16); }); }; export default mewtime;