@live-change/uid 0.8.136 → 0.8.138

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.
Files changed (2) hide show
  1. package/index.js +7 -1
  2. package/package.json +2 -2
package/index.js CHANGED
@@ -93,7 +93,12 @@ function decodeUid(uid) {
93
93
  const date = decodeDate(uid.slice(1, dotIndex))
94
94
  const number = decodeNumber(uid.slice(dotIndex + 1, atIndex))
95
95
  const at = uid.slice(atIndex + 1, -1)
96
- return { date, number, at }
96
+ const borders = uid.slice(0, 1) + uid.slice(-1)
97
+ return { date, number, at, borders }
98
+ }
99
+
100
+ function encodeUid({ date, number, at, borders }) {
101
+ return borders[0] + encodeDate(date) + '.' + encodeNumber(number) + '@' + at + borders[1]
97
102
  }
98
103
 
99
104
  function verifyUidSource(uid, source) {
@@ -109,5 +114,6 @@ export {
109
114
  randomString,
110
115
  uidGenerator,
111
116
  decodeUid,
117
+ encodeUid,
112
118
  verifyUidSource
113
119
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@live-change/uid",
3
- "version": "0.8.136",
3
+ "version": "0.8.138",
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": "a641c8fbe90fa2383c623eaae18563765d1db28a"
24
+ "gitHead": "1f054bf57145194109ac510b06faa08af6733e6e"
25
25
  }