@aitianyu.cn/types 0.0.7 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,11 +2,14 @@
2
2
  /**@format */
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.guid = void 0;
5
- const perf_hooks_1 = require("perf_hooks");
6
5
  /** Generate a Guid value string */
7
6
  function guid() {
8
7
  let d = new Date().getTime();
9
- d += perf_hooks_1.performance.now(); //use high-precision timer if available
8
+ if (typeof performance === "undefined") {
9
+ // global.performance = require("perf_hooks").performance;
10
+ global.performance = eval("require")("perf_hooks").performance;
11
+ }
12
+ d += performance.now(); //use high-precision timer if available
10
13
  const uuid = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
11
14
  const r = (d + Math.random() * 16) % 16 | 0; // d是随机种子
12
15
  d = Math.floor(d / 16);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aitianyu.cn/types",
3
- "version": "0.0.7",
3
+ "version": "0.0.8",
4
4
  "private": false,
5
5
  "description": "Common modules (types, functions, classes) for aitianyu",
6
6
  "main": "./dist/lib/index.js",