@woosmap/ui 4.28.4 → 4.28.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@woosmap/ui",
3
- "version": "4.28.4",
3
+ "version": "4.28.5",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/WebGeoServices/ui.git"
@@ -1,9 +1,6 @@
1
- export default function uniqueid(prefix = 'id') {
2
- function s4() {
3
- return Math.floor((1 + Math.random()) * 0x10000)
4
- .toString(16)
5
- .substring(1);
6
- }
1
+ let lastId = 0;
7
2
 
8
- return `${prefix}-${s4() + s4()}-${s4()}-${s4()}-${s4()}-${s4()}${s4()}${s4()}`;
3
+ export default function uniqueid(prefix = 'id') {
4
+ lastId++;
5
+ return `${prefix}${lastId}`;
9
6
  }
@@ -0,0 +1,11 @@
1
+ import uniqueId from './uniqueid';
2
+
3
+ it('generates a uniqueId', () => {
4
+ const myId = uniqueId('prefix');
5
+ const myId2 = uniqueId('prefix');
6
+
7
+ const val = myId.replace('prefix', '');
8
+ const val2 = myId2.replace('prefix', '');
9
+
10
+ expect(parseInt(val, 10) + 1).toEqual(parseInt(val2, 10));
11
+ });