@shakerquiz/utilities 4.0.102 → 4.0.104

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": "4.0.102",
4
+ "version": "4.0.104",
5
5
  "author": "yurkimus <yurkimus@gmail.com>",
6
6
  "license": "ISC",
7
7
  "repository": {
@@ -0,0 +1,7 @@
1
+ export const RegistrationExportFormat = /** @type {const} */ ({
2
+ 'Csv': 'Csv',
3
+ 'Xlsx': 'Xlsx',
4
+ 'Json': 'Json',
5
+ })
6
+
7
+ export const RegistrationExportFormats = Object.values(RegistrationExportFormat)
@@ -0,0 +1,35 @@
1
+ export const RegistrationTableColumn = /** @type {const} */ ({
2
+ 'id': 'id',
3
+ 'human_name': 'human_name',
4
+ 'email': 'email',
5
+ 'phone': 'phone',
6
+ 'team_name': 'team_name',
7
+ 'people_count': 'people_count',
8
+ 'is_first': 'is_first',
9
+ 'is_birthday': 'is_birthday',
10
+ 'is_extensible': 'is_extensible',
11
+ 'is_alone': 'is_alone',
12
+ 'ads_from': 'ads_from',
13
+ 'comment': 'comment',
14
+ 'promocode': 'promocode',
15
+ 'channel': 'channel',
16
+ 'vkontakte': 'vkontakte',
17
+ 'telegram': 'telegram',
18
+ 'chatapp_id': 'chatapp_id',
19
+ 'utm_term': 'utm_term',
20
+ 'utm_source': 'utm_source',
21
+ 'utm_medium': 'utm_medium',
22
+ 'utm_content': 'utm_content',
23
+ 'utm_campaign': 'utm_campaign',
24
+ 'confirmed_channel': 'confirmed_channel',
25
+ 'status': 'status',
26
+ 'lineup': 'lineup',
27
+ 'mailing': 'mailing',
28
+ 'celebrant': 'celebrant',
29
+ 'note': 'note',
30
+ 'visibility': 'visibility',
31
+ 'time_created': 'time_created',
32
+ 'time_updated': 'time_updated',
33
+ })
34
+
35
+ export const RegistrationTableColumns = Object.values(RegistrationTableColumn)
@@ -1,46 +1,74 @@
1
1
  /**
2
- * @type {typeof Object.hasOwn}
2
+ * @param {object} o
3
+ * @param {...PropertyKey} ks
3
4
  */
4
- export const hasOwn = Object.hasOwn
5
+ export const hasOwn = (o, ...ks) => {
6
+ if (o === null)
7
+ return false
8
+ else if (o === undefined)
9
+ return false
10
+ else if (ks.length < 1)
11
+ return false
12
+ else
13
+ return ks.every(v => Object.hasOwn(o, v))
14
+ }
5
15
 
6
16
  /**
7
17
  * @param {object} o
8
- * @param {PropertyKey} v
18
+ * @param {PropertyKey} k
9
19
  *
10
20
  * @returns {*}
11
21
  */
12
- export const tryOwn = (o, v) => hasOwn(o, v) ? o[v] : undefined
22
+ export const tryOwn = (o, k) => hasOwn(o, k) ? o[k] : undefined
13
23
 
14
24
  /**
15
25
  * @param {object} o
16
- * @param {PropertyKey} v
26
+ * @param {PropertyKey} k
17
27
  *
18
28
  * @throws {TypeError}
19
29
  *
20
30
  * @returns {any}
21
31
  */
22
- export const getOwn = (o, v) => {
23
- if (!hasOwn(o, v))
24
- throw TypeError(`Property '${v}' is not assigned.`)
32
+ export const getOwn = (o, k) => {
33
+ if (!hasOwn(o, k))
34
+ throw TypeError(`Property '${k}' is not assigned.`)
25
35
 
26
- if (tryOwn(o, v) === undefined)
27
- throw TypeError(`Property '${v}' is not undefined.`)
36
+ var v = tryOwn(o, k)
28
37
 
29
- return o[v]
30
- }
38
+ if (v === undefined)
39
+ throw TypeError(`Property '${k}' is undefined.`)
31
40
 
32
- export const set = (object, key, value) => {
33
- var result = { ...object }
41
+ return v
42
+ }
34
43
 
35
- result[key] = value
44
+ /**
45
+ * @param {object} o
46
+ * @param {PropertyKey} k
47
+ * @param {any} v
48
+ */
49
+ export const setOwn = (o, k, v) => ({ ...o, [k]: v })
36
50
 
37
- return result
38
- }
51
+ /**
52
+ * @deprecated
53
+ *
54
+ * @param {object} o
55
+ * @param {PropertyKey} k
56
+ * @param {any} v
57
+ */
58
+ export const set = setOwn
39
59
 
40
- export const remove = (object, key) => {
41
- var result = { ...object }
60
+ /**
61
+ * @param {object} o
62
+ * @param {...object} os
63
+ */
64
+ export const assignOwn = (o, ...os) => Object.assign({}, o, ...os)
42
65
 
43
- delete result[key]
66
+ /**
67
+ * @param {object} o
68
+ * @param {PropertyKey} k
69
+ */
70
+ export const removeOwn = (o, k) => {
71
+ var { [k]: _, ...x } = o
44
72
 
45
- return result
73
+ return x
46
74
  }
package/source/index.js CHANGED
@@ -24,6 +24,7 @@ export * from './entities/quantifier.js'
24
24
  export * from './entities/registration-attribute.js'
25
25
  export * from './entities/registration-cancellation.js'
26
26
  export * from './entities/registration-channel.js'
27
+ export * from './entities/registration-export-format.js'
27
28
  export * from './entities/registration-confirmation.js'
28
29
  export * from './entities/registration-interval.js'
29
30
  export * from './entities/registration-lineup-procedure.js'
@@ -35,6 +36,7 @@ export * from './entities/registration-reservation.js'
35
36
  export * from './entities/registration-restoration.js'
36
37
  export * from './entities/registration-status-procedure.js'
37
38
  export * from './entities/registration-status.js'
39
+ export * from './entities/registration-table-column.js'
38
40
  export * from './entities/registration-visibility.js'
39
41
  export * from './entities/role.js'
40
42
  export * from './entities/routes.js'