LookAtMySuitBot/js/node_modules/uuid-1345/examples/example2.js

66 lines
1.3 KiB
JavaScript
Raw Normal View History

2023-12-24 20:08:39 -05:00
var UUID = require('../index');
setTimeout(function () {
UUID.v1({}, function (err, id) {
if (err) {
throw err;
}
console.log(id);
console.log(JSON.stringify(UUID.check(id), null, 2));
console.log(UUID.stringify(UUID.parse(id)));
});
UUID.v1({}, function (err, id) {
if (err) {
throw err;
}
console.log(id);
console.log(JSON.stringify(UUID.check(id), null, 2));
console.log(UUID.stringify(UUID.parse(id)));
});
UUID.v4(function (err, id) {
console.log(id);
console.log(JSON.stringify(UUID.check(id), null, 2));
console.log(UUID.stringify(UUID.parse(id)));
});
UUID.v3({
namespace: UUID.namespace.url,
name: "http://github.com"
}, function (err, id) {
if (err) {
throw err;
}
console.log(id);
console.log(JSON.stringify(UUID.check(id), null, 2));
console.log(UUID.stringify(UUID.parse(id)));
});
UUID.v5({
namespace: UUID.namespace.url,
name: "http://github.com"
}, function (err, id) {
if (err) {
throw err;
}
console.log(id);
console.log(JSON.stringify(UUID.check(id), null, 2));
console.log(UUID.stringify(UUID.parse(id)));
});
}, 10);