# uuidjs
UUID.js-JavaScript的RFC兼容UUID生成器
```
// 创建一个版本4(基于随机数的)UUID对象
var objV4 = UUID.genV4();
// 创建一个版本1(基于时间的)UUID对象
var objV1 = UUID.genV1();
// 从十六进制字符串创建UUID对象
var uuid = UUID.parse("a0e0f130-8c21-11df-92d9-95795a3bcd40");
// 获取UUID对象的字符串表示
console.log(uuid.toString()); // "a0e0f130-8c21-11df-92d9-95795a3bcd40"
console.log(uuid.hexString); // "a0e0f130-8c21-11df-92d9-95795a3bcd40"
console.log(uuid.hexNoDelim); // "a0e0f1308c2111df92d995795a3bcd40"
console.log(uuid.bitString); // "101000001110000 ... 1100110101000000"
console.log(uuid.urn); // "urn:uuid:a0e0f130-8c21-11df-92d9-95795a3bcd40"
// 比较对象UUID
console.log(objV4.equals(objV1)); // false
// 获取UUID版本号
console.log(objV4.version); // 4
console.log(objV1.version); // 1
// 通过2个不同的访问器以3种不同的形式获取内部字段值
console.log(uuid.intFields.timeLow); // 2699096368
console.log(uuid.bitFields.timeMid); // "1000110000100001"
console.log(uuid.hexFields.timeHiAndVersion); // "11df"
console.log(uuid.intFields.clockSeqHiAndReserved); // 146
console.log(uuid.bitFields.clockSeqLow); // "11011001"
console.log(uuid.hexFields.node); // "95795a3bcd40"
console.log(uuid.intFields\[0\]); // 2699096368
console.log(uuid.bitFields\[1\]); // "1000110000100001"
console.log(uuid.hexFields\[2\]); // "11df"
console.log(uuid.intFields\[3\]); // 146
console.log(uuid.bitFields\[4\]); // "11011001"
console.log(uuid.hexFields\[5\]);
```