@shakerquiz/utilities 0.5.99 → 0.5.101

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,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@shakerquiz/utilities",
4
- "version": "0.5.99",
4
+ "version": "0.5.101",
5
5
  "author": "yurkimus <yurkimus@gmail.com>",
6
6
  "license": "ISC",
7
7
  "repository": {
@@ -0,0 +1,25 @@
1
+ export var VenueCityMode = /** @type {const} */ ({
2
+ 'known': 'known',
3
+ 'unknown': 'unknown',
4
+ })
5
+
6
+ /**
7
+ * @returns {keyof typeof VenueCityMode}
8
+ */
9
+ var get = value =>
10
+ value in VenueCityMode
11
+ ? value
12
+ : VenueCityMode['unknown']
13
+
14
+ export var getVenueCityMode = value => {
15
+ switch (typeof value) {
16
+ case 'string':
17
+ return get(value)
18
+
19
+ case 'object':
20
+ return get(value?.mode)
21
+
22
+ default:
23
+ return get(undefined)
24
+ }
25
+ }
@@ -1,32 +1,46 @@
1
1
  export var VenueStatus = /** @type {const} */ ({
2
2
  'ACTIVE': 'ACTIVE',
3
3
  'ARCHIVE': 'ARCHIVE',
4
+ 'UNKNOWN': 'UNKNOWN',
4
5
  })
5
6
 
6
7
  export var VenueStatuses = Object.values(VenueStatus)
7
8
 
8
9
  export var VenueStatusWeight = {
9
- [VenueStatus.ACTIVE]: 0,
10
- [VenueStatus.ARCHIVE]: 1,
10
+ [VenueStatus['ACTIVE']]: 0,
11
+ [VenueStatus['ARCHIVE']]: 1,
11
12
  }
12
13
 
13
14
  export var VenueStatusTitle = {
14
- [VenueStatus.ACTIVE]: 'Активно',
15
- [VenueStatus.ARCHIVE]: 'Архив',
15
+ [VenueStatus['ACTIVE']]: 'Активно',
16
+ [VenueStatus['ARCHIVE']]: 'Архив',
17
+ [VenueStatus['UNKNOWN']]: 'Неизвестно',
16
18
  }
17
19
 
18
- export var VenueStatusColor = {
19
- [VenueStatus.ACTIVE]: 'success',
20
- [VenueStatus.ARCHIVE]: 'current',
20
+ /** @type {Record<VenueStatus, Icon>} */
21
+ export var VenueStatusIcon = {
22
+ [VenueStatus['ACTIVE']]: 'hero/outline/check',
23
+ [VenueStatus['ARCHIVE']]: 'hero/outline/archive-box',
24
+ [VenueStatus['UNKNOWN']]: 'hero/outline/no-symbol',
21
25
  }
22
26
 
23
- export var VenueStatusTextColor = {
24
- [VenueStatus.ACTIVE]: 'text-success',
25
- [VenueStatus.ARCHIVE]: 'text-current',
26
- }
27
+ /**
28
+ * @returns {keyof typeof VenueStatus}
29
+ */
30
+ var get = value =>
31
+ value in VenueStatus
32
+ ? value
33
+ : VenueStatus['UNKNOWN']
27
34
 
28
- /** @type {Record<VenueStatus, Icon>} */
29
- export var VenueStatusIcon = {
30
- [VenueStatus.ACTIVE]: 'hero/outline/check',
31
- [VenueStatus.ARCHIVE]: 'hero/outline/archive-box',
35
+ export var getVenueStatus = value => {
36
+ switch (typeof value) {
37
+ case 'string':
38
+ return get(value)
39
+
40
+ case 'object':
41
+ return get(value?.status)
42
+
43
+ default:
44
+ return get(undefined)
45
+ }
32
46
  }
package/source/index.js CHANGED
@@ -21,6 +21,7 @@ export * from './enumerations/entities/registration-mailing.js'
21
21
  export * from './enumerations/entities/registration-status.js'
22
22
  export * from './enumerations/entities/role-mode.js'
23
23
  export * from './enumerations/entities/role.js'
24
+ export * from './enumerations/entities/venue-city-mode.js'
24
25
  export * from './enumerations/entities/venue-status.js'
25
26
  export * from './enumerations/entities/venues-mode.js'
26
27
  export * from './enumerations/entities/version.js'