until.ts 502 B

12345678910111213141516171819
  1. // 生成uuid
  2. export function uuid() {
  3. const s = [];
  4. const hexDigits = "0123456789abcdef";
  5. for (let i = 0; i < 36; i++) {
  6. s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
  7. }
  8. s[14] = "4";
  9. s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1);
  10. s[8] = s[13] = s[18] = s[23] = "-";
  11. const uuid = s.join("");
  12. return `${uuid}-${new Date().getTime()}`;
  13. }
  14. export function rgbaNum(rgba: string) {
  15. let val = rgba.match(/(\d(\.\d+)?)+/g);
  16. return val;
  17. }