uuid
1.1、uuid简介
是什么 ?:a JavaScript library to generate RFC4122-compliant UUIDs.
开发语言:JavaScript
源码仓库:https://github.com/uuidjs/uuid
运行环境:Web浏览器Node.js Runtime
1.2、通过包管理器安装uuid
包管理器安装命令
bowerbower install uuid --save
npmnpm install uuid --save
yarnyarn add uuid
1.3、在HTML代码中引入uuid
<script src="/bower_components/uuid/dist/uuid.min.js"></script>
1.4、在Node.js代码中导入uuid模块
const uuid = require('uuid');

const { v4 : uuidv4 } = require('uuid');
1.5、uuid API
const uuid = require('uuid');

uuid.v1(); // ⇨ '2c5ea4c0-4067-11e9-8bad-9b1deb4d3b7d'
uuid.v4(); // ⇨ '9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d'
uuid.uuidv3('hello.example.com', uuidv3.DNS); // ⇨ '9125a8dc-52ee-365b-a5aa-81b0b3681cf6'
uuid.uuidv5('hello.example.com', uuidv5.DNS); // ⇨ 'fdda765f-fc57-5604-a269-52a7df8164ec'