@lijuhong1981/jsmath 1.0.17 → 1.0.19

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.
package/index.js CHANGED
@@ -33,6 +33,7 @@ import {
33
33
  EPSILON20,
34
34
  EPSILON21,
35
35
  } from "./src/Constant.js";
36
+ import generateUUID from "./src/generateUUID.js";
36
37
  import degToRad from "./src/degToRad.js";
37
38
  import radToDeg from "./src/radToDeg.js";
38
39
  import clamp from "./src/clamp.js";
@@ -89,6 +90,7 @@ export {
89
90
  EPSILON19,
90
91
  EPSILON20,
91
92
  EPSILON21,
93
+ generateUUID,
92
94
  degToRad,
93
95
  radToDeg,
94
96
  clamp,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lijuhong1981/jsmath",
3
- "version": "1.0.17",
3
+ "version": "1.0.19",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "module": "index.js",
package/src/Range.js CHANGED
@@ -137,8 +137,6 @@ class Range {
137
137
  * @returns {Boolean}
138
138
  */
139
139
  static equals(left, right) {
140
- Check.instanceOf('left', left, Range);
141
- Check.instanceOf('right', right, Range);
142
140
  if (left === right)
143
141
  return true;
144
142
  if (left && right && left.minimum === right.minimum && left.maximum === right.maximum && left.containsMinimum === right.containsMinimum && left.containsMaximum === right.containsMaximum)
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Creates a Universally Unique IDentifier (UUID) string. A UUID is 128 bits long, and can guarantee uniqueness across space and time.
3
+ *
4
+ * @function
5
+ *
6
+ * @returns {String}
7
+ *
8
+ * @see {@link http://www.ietf.org/rfc/rfc4122.txt RFC 4122 A Universally Unique IDentifier (UUID) URN Namespace}
9
+ */
10
+ function generateUUID() {
11
+ // http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript
12
+ return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
13
+ const r = (Math.random() * 16) | 0;
14
+ const v = c === "x" ? r : (r & 0x3) | 0x8;
15
+ return v.toString(16);
16
+ });
17
+ }
18
+
19
+ export default generateUUID;