@webex/common 2.59.3-next.1 → 2.59.4

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 (80) hide show
  1. package/.eslintrc.js +6 -6
  2. package/README.md +42 -42
  3. package/babel.config.js +3 -3
  4. package/dist/base64.js +22 -22
  5. package/dist/base64.js.map +1 -1
  6. package/dist/browser-detection.js.map +1 -1
  7. package/dist/capped-debounce.js +12 -12
  8. package/dist/capped-debounce.js.map +1 -1
  9. package/dist/check-required.js +8 -8
  10. package/dist/check-required.js.map +1 -1
  11. package/dist/constants.js.map +1 -1
  12. package/dist/defer.js +13 -13
  13. package/dist/defer.js.map +1 -1
  14. package/dist/deprecated.js +5 -5
  15. package/dist/deprecated.js.map +1 -1
  16. package/dist/event-envelope.js +11 -11
  17. package/dist/event-envelope.js.map +1 -1
  18. package/dist/events.js +15 -15
  19. package/dist/events.js.map +1 -1
  20. package/dist/exception.js +13 -13
  21. package/dist/exception.js.map +1 -1
  22. package/dist/in-browser/browser.js +2 -2
  23. package/dist/in-browser/browser.js.map +1 -1
  24. package/dist/in-browser/index.js.map +1 -1
  25. package/dist/in-browser/node.js +2 -2
  26. package/dist/in-browser/node.js.map +1 -1
  27. package/dist/index.js.map +1 -1
  28. package/dist/isBuffer.js +6 -6
  29. package/dist/isBuffer.js.map +1 -1
  30. package/dist/make-state-datatype.js +14 -14
  31. package/dist/make-state-datatype.js.map +1 -1
  32. package/dist/one-flight.js +13 -13
  33. package/dist/one-flight.js.map +1 -1
  34. package/dist/patterns.js +30 -30
  35. package/dist/patterns.js.map +1 -1
  36. package/dist/resolve-with.js +19 -19
  37. package/dist/resolve-with.js.map +1 -1
  38. package/dist/retry.js +17 -17
  39. package/dist/retry.js.map +1 -1
  40. package/dist/tap.js +14 -14
  41. package/dist/tap.js.map +1 -1
  42. package/dist/template-container.js +51 -51
  43. package/dist/template-container.js.map +1 -1
  44. package/dist/uuid-utils.js +76 -76
  45. package/dist/uuid-utils.js.map +1 -1
  46. package/dist/while-in-flight.js +5 -5
  47. package/dist/while-in-flight.js.map +1 -1
  48. package/jest.config.js +3 -3
  49. package/package.json +11 -12
  50. package/process +1 -1
  51. package/src/base64.js +67 -67
  52. package/src/browser-detection.js +37 -37
  53. package/src/capped-debounce.js +65 -65
  54. package/src/check-required.js +18 -18
  55. package/src/constants.js +79 -79
  56. package/src/defer.js +24 -24
  57. package/src/deprecated.js +19 -19
  58. package/src/event-envelope.js +54 -54
  59. package/src/events.js +55 -55
  60. package/src/exception.js +45 -45
  61. package/src/in-browser/browser.js +5 -5
  62. package/src/in-browser/index.js +11 -11
  63. package/src/in-browser/node.js +5 -5
  64. package/src/index.js +44 -44
  65. package/src/isBuffer.js +12 -12
  66. package/src/make-state-datatype.js +91 -91
  67. package/src/one-flight.js +89 -89
  68. package/src/patterns.js +51 -51
  69. package/src/resolve-with.js +27 -27
  70. package/src/retry.js +124 -124
  71. package/src/tap.js +25 -25
  72. package/src/template-container.js +222 -222
  73. package/src/uuid-utils.js +189 -189
  74. package/src/while-in-flight.js +38 -38
  75. package/test/unit/spec/capped-debounce.js +103 -103
  76. package/test/unit/spec/common.js +42 -42
  77. package/test/unit/spec/exception.js +102 -102
  78. package/test/unit/spec/one-flight.js +211 -211
  79. package/test/unit/spec/template-container.js +81 -81
  80. package/test/unit/spec/while-in-flight.js +70 -70
@@ -1,222 +1,222 @@
1
- /*!
2
- * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
3
- */
4
-
5
- import util from 'util';
6
-
7
- /**
8
- * Factory which produces a multi-keyed container based on the provided set of
9
- * constructors
10
- * @param {mixed} containers
11
- * @returns {Container}
12
- */
13
- function make(...containers) {
14
- const TopContainer = containers.shift();
15
-
16
- const data = new WeakMap();
17
- const sizes = new WeakMap();
18
-
19
- const ChildContainer = containers.length > 1 ? make(...containers) : containers[0];
20
-
21
- const name = `(${[TopContainer.name]
22
- .concat(containers.map((container) => container.name))
23
- .join(', ')})`;
24
-
25
- /**
26
- * Container that wraps an arbitrary set of tupples to their values
27
- */
28
- class Container {
29
- /**
30
- * @constructs Container
31
- */
32
- constructor(...args) {
33
- data.set(this, new TopContainer(...args));
34
- sizes.set(this, 0);
35
- }
36
-
37
- /**
38
- * getter for .size
39
- * @returns {number}
40
- */
41
- get size() {
42
- return sizes.get(this);
43
- }
44
-
45
- /**
46
- * Identical to Container#set() but leads slightly more intuitive code when
47
- * the container is based on a Set rather than a Map.
48
- * @returns {Container}
49
- */
50
- add(...args) {
51
- return this.set(...args);
52
- }
53
-
54
- /**
55
- * Removes all items from the container
56
- * @returns {undefined}
57
- */
58
- clear() {
59
- const ret = data.get(this).clear();
60
-
61
- sizes.set(this, 0);
62
-
63
- return ret;
64
- }
65
-
66
- /**
67
- * Removes the specified item to the container
68
- * @param {mixed} key
69
- * @param {Array<mixed>} keys
70
- * @returns {boolean}
71
- */
72
- delete(key, ...keys) {
73
- const mine = data.get(this);
74
-
75
- if (!keys.length) {
76
- return mine.delete(key);
77
- }
78
-
79
- const next = mine.get(key);
80
-
81
- if (!next) {
82
- return false;
83
- }
84
-
85
- const ret = next.delete(...keys);
86
-
87
- if (ret) {
88
- sizes.set(this, sizes.get(this) - 1);
89
- }
90
-
91
- if (next.size === 0) {
92
- mine.delete(key);
93
- }
94
-
95
- return ret;
96
- }
97
-
98
- /**
99
- * Retrieves the specified item from the container
100
- * @param {mixed} key
101
- * @param {Array<mixed>} keys
102
- * @returns {mixed}
103
- */
104
- get(key, ...keys) {
105
- const mine = data.get(this);
106
-
107
- if (!mine.get) {
108
- return mine;
109
- }
110
-
111
- if (!keys.length) {
112
- return mine.get(key);
113
- }
114
-
115
- const next = mine.get(key);
116
-
117
- if (!next) {
118
- return undefined;
119
- }
120
-
121
- if (!next.get) {
122
- return next;
123
- }
124
-
125
- return next.get(...keys);
126
- }
127
-
128
- /**
129
- * Indicates whether the container holds the specified item
130
- * @param {mixed} key
131
- * @param {Array<mixed>} keys
132
- * @returns {Boolean}
133
- */
134
- has(...args) {
135
- return typeof this.get(...args) !== 'undefined';
136
- }
137
-
138
- /**
139
- * Stores the specified item in the container
140
- * @param {mixed} key
141
- * @param {Array<mixed>} args
142
- * @param {mixed} value
143
- * @returns {Container}
144
- */
145
- set(...args) {
146
- let overwrite = false;
147
-
148
- if (this.has(...args)) {
149
- overwrite = true;
150
- }
151
- const mine = data.get(this);
152
-
153
- const key = args.shift();
154
-
155
- if (!mine.get) {
156
- insert(mine, key, ...args);
157
-
158
- return this;
159
- }
160
-
161
- let next = mine.get(key);
162
-
163
- if (!next) {
164
- if (!ChildContainer) {
165
- insert(mine, key, ...args);
166
-
167
- return this;
168
- }
169
- next = new ChildContainer();
170
- insert(mine, key, next);
171
- }
172
- insert(next, ...args);
173
-
174
- if (!overwrite) {
175
- sizes.set(this, sizes.get(this) + 1);
176
- }
177
-
178
- return this;
179
- }
180
-
181
- /**
182
- * @private
183
- * @returns {string}
184
- */
185
- inspect() {
186
- return `Container${name} {
187
- ${util.inspect(data.get(this), {depth: null})}
188
- }`;
189
- }
190
- }
191
-
192
- return Container;
193
- }
194
-
195
- /**
196
- * Inserts into an arbitrary container
197
- * @param {Map|WeakMap|Set|WeakSet} container
198
- * @param {Array<mixed>} args
199
- * @private
200
- * @returns {undefined}
201
- */
202
- function insert(container, ...args) {
203
- if (container.add) {
204
- container.add(...args);
205
-
206
- return;
207
- }
208
-
209
- if (container.set) {
210
- container.set(...args);
211
-
212
- return;
213
- }
214
-
215
- if (container.push) {
216
- container.push(...args);
217
-
218
- return;
219
- }
220
- throw new TypeError('Could not determine how to insert into the specified container');
221
- }
222
- export {make as default};
1
+ /*!
2
+ * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
3
+ */
4
+
5
+ import util from 'util';
6
+
7
+ /**
8
+ * Factory which produces a multi-keyed container based on the provided set of
9
+ * constructors
10
+ * @param {mixed} containers
11
+ * @returns {Container}
12
+ */
13
+ function make(...containers) {
14
+ const TopContainer = containers.shift();
15
+
16
+ const data = new WeakMap();
17
+ const sizes = new WeakMap();
18
+
19
+ const ChildContainer = containers.length > 1 ? make(...containers) : containers[0];
20
+
21
+ const name = `(${[TopContainer.name]
22
+ .concat(containers.map((container) => container.name))
23
+ .join(', ')})`;
24
+
25
+ /**
26
+ * Container that wraps an arbitrary set of tupples to their values
27
+ */
28
+ class Container {
29
+ /**
30
+ * @constructs Container
31
+ */
32
+ constructor(...args) {
33
+ data.set(this, new TopContainer(...args));
34
+ sizes.set(this, 0);
35
+ }
36
+
37
+ /**
38
+ * getter for .size
39
+ * @returns {number}
40
+ */
41
+ get size() {
42
+ return sizes.get(this);
43
+ }
44
+
45
+ /**
46
+ * Identical to Container#set() but leads slightly more intuitive code when
47
+ * the container is based on a Set rather than a Map.
48
+ * @returns {Container}
49
+ */
50
+ add(...args) {
51
+ return this.set(...args);
52
+ }
53
+
54
+ /**
55
+ * Removes all items from the container
56
+ * @returns {undefined}
57
+ */
58
+ clear() {
59
+ const ret = data.get(this).clear();
60
+
61
+ sizes.set(this, 0);
62
+
63
+ return ret;
64
+ }
65
+
66
+ /**
67
+ * Removes the specified item to the container
68
+ * @param {mixed} key
69
+ * @param {Array<mixed>} keys
70
+ * @returns {boolean}
71
+ */
72
+ delete(key, ...keys) {
73
+ const mine = data.get(this);
74
+
75
+ if (!keys.length) {
76
+ return mine.delete(key);
77
+ }
78
+
79
+ const next = mine.get(key);
80
+
81
+ if (!next) {
82
+ return false;
83
+ }
84
+
85
+ const ret = next.delete(...keys);
86
+
87
+ if (ret) {
88
+ sizes.set(this, sizes.get(this) - 1);
89
+ }
90
+
91
+ if (next.size === 0) {
92
+ mine.delete(key);
93
+ }
94
+
95
+ return ret;
96
+ }
97
+
98
+ /**
99
+ * Retrieves the specified item from the container
100
+ * @param {mixed} key
101
+ * @param {Array<mixed>} keys
102
+ * @returns {mixed}
103
+ */
104
+ get(key, ...keys) {
105
+ const mine = data.get(this);
106
+
107
+ if (!mine.get) {
108
+ return mine;
109
+ }
110
+
111
+ if (!keys.length) {
112
+ return mine.get(key);
113
+ }
114
+
115
+ const next = mine.get(key);
116
+
117
+ if (!next) {
118
+ return undefined;
119
+ }
120
+
121
+ if (!next.get) {
122
+ return next;
123
+ }
124
+
125
+ return next.get(...keys);
126
+ }
127
+
128
+ /**
129
+ * Indicates whether the container holds the specified item
130
+ * @param {mixed} key
131
+ * @param {Array<mixed>} keys
132
+ * @returns {Boolean}
133
+ */
134
+ has(...args) {
135
+ return typeof this.get(...args) !== 'undefined';
136
+ }
137
+
138
+ /**
139
+ * Stores the specified item in the container
140
+ * @param {mixed} key
141
+ * @param {Array<mixed>} args
142
+ * @param {mixed} value
143
+ * @returns {Container}
144
+ */
145
+ set(...args) {
146
+ let overwrite = false;
147
+
148
+ if (this.has(...args)) {
149
+ overwrite = true;
150
+ }
151
+ const mine = data.get(this);
152
+
153
+ const key = args.shift();
154
+
155
+ if (!mine.get) {
156
+ insert(mine, key, ...args);
157
+
158
+ return this;
159
+ }
160
+
161
+ let next = mine.get(key);
162
+
163
+ if (!next) {
164
+ if (!ChildContainer) {
165
+ insert(mine, key, ...args);
166
+
167
+ return this;
168
+ }
169
+ next = new ChildContainer();
170
+ insert(mine, key, next);
171
+ }
172
+ insert(next, ...args);
173
+
174
+ if (!overwrite) {
175
+ sizes.set(this, sizes.get(this) + 1);
176
+ }
177
+
178
+ return this;
179
+ }
180
+
181
+ /**
182
+ * @private
183
+ * @returns {string}
184
+ */
185
+ inspect() {
186
+ return `Container${name} {
187
+ ${util.inspect(data.get(this), {depth: null})}
188
+ }`;
189
+ }
190
+ }
191
+
192
+ return Container;
193
+ }
194
+
195
+ /**
196
+ * Inserts into an arbitrary container
197
+ * @param {Map|WeakMap|Set|WeakSet} container
198
+ * @param {Array<mixed>} args
199
+ * @private
200
+ * @returns {undefined}
201
+ */
202
+ function insert(container, ...args) {
203
+ if (container.add) {
204
+ container.add(...args);
205
+
206
+ return;
207
+ }
208
+
209
+ if (container.set) {
210
+ container.set(...args);
211
+
212
+ return;
213
+ }
214
+
215
+ if (container.push) {
216
+ container.push(...args);
217
+
218
+ return;
219
+ }
220
+ throw new TypeError('Could not determine how to insert into the specified container');
221
+ }
222
+ export {make as default};