guid.js 497 B

12345678910111213141516171819
  1. /*!
  2. * All material copyright ESRI, All Rights Reserved, unless otherwise specified.
  3. * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
  4. * v1.0.0-beta.97
  5. */
  6. function gen(counts) {
  7. return counts
  8. .map((count) => {
  9. let out = "";
  10. for (let i = 0; i < count; i++) {
  11. out += (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
  12. }
  13. return out;
  14. })
  15. .join("-");
  16. }
  17. const guid = () => gen([2, 1, 1, 1, 3]);
  18. export { guid as g };