@live-change/uid 0.8.110 → 0.8.112
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 +3 -3
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -60,7 +60,7 @@ function randomString(length = 8) {
|
|
|
60
60
|
|
|
61
61
|
function hashCode(str) {
|
|
62
62
|
let hash = 0
|
|
63
|
-
if(str.length
|
|
63
|
+
if(str.length === 0) return hash
|
|
64
64
|
for(let i = 0; i < str.length; i++) {
|
|
65
65
|
const char = str.charCodeAt(i)
|
|
66
66
|
hash = ((hash << 5) - hash) + char
|
|
@@ -74,7 +74,7 @@ function uidGenerator(fingerprint = randomString(4), numberLength = 0, borders =
|
|
|
74
74
|
function next() {
|
|
75
75
|
const date = new Date()
|
|
76
76
|
const now = date.getTime()
|
|
77
|
-
if(now
|
|
77
|
+
if(now === lastMillisecond) {
|
|
78
78
|
lastId ++
|
|
79
79
|
} else {
|
|
80
80
|
lastId = 0
|
|
@@ -98,7 +98,7 @@ function decodeUid(uid) {
|
|
|
98
98
|
|
|
99
99
|
function verifyUidSource(uid, source) {
|
|
100
100
|
const { at } = decodeUid(uid)
|
|
101
|
-
return at.slice(0, source.length)
|
|
101
|
+
return at.slice(0, source.length) === source
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
export {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@live-change/uid",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.112",
|
|
4
4
|
"description": "Simple unique id generator with timestamp and source",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -21,5 +21,5 @@
|
|
|
21
21
|
"url": "https://github.com/live-change/live-change-stack/issues"
|
|
22
22
|
},
|
|
23
23
|
"homepage": "https://github.com/live-change/live-change-stack",
|
|
24
|
-
"gitHead": "
|
|
24
|
+
"gitHead": "e0d0db33777f8f9fc9f5ebe1a977cf574b837be6"
|
|
25
25
|
}
|