@splitsoftware/splitio-commons 1.17.1-rc.3 → 2.0.0-rc.0

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 (216) hide show
  1. package/CHANGES.txt +7 -3
  2. package/cjs/evaluator/index.js +2 -2
  3. package/cjs/evaluator/matchers/semver_inlist.js +1 -2
  4. package/cjs/evaluator/matchers/whitelist.js +1 -2
  5. package/cjs/listeners/browser.js +1 -2
  6. package/cjs/logger/browser/DebugLogger.js +1 -2
  7. package/cjs/logger/browser/ErrorLogger.js +1 -2
  8. package/cjs/logger/browser/InfoLogger.js +1 -2
  9. package/cjs/logger/browser/WarnLogger.js +1 -2
  10. package/cjs/logger/index.js +1 -2
  11. package/cjs/readiness/readinessManager.js +5 -7
  12. package/cjs/sdkClient/clientCS.js +5 -8
  13. package/cjs/sdkClient/sdkClientMethodCS.js +5 -8
  14. package/cjs/sdkFactory/index.js +10 -33
  15. package/cjs/services/decorateHeaders.js +1 -2
  16. package/cjs/storages/AbstractSplitsCacheAsync.js +7 -0
  17. package/cjs/storages/AbstractSplitsCacheSync.js +7 -0
  18. package/cjs/storages/KeyBuilderCS.js +0 -9
  19. package/cjs/storages/dataLoader.js +32 -64
  20. package/cjs/storages/inLocalStorage/MySegmentsCacheInLocal.js +1 -21
  21. package/cjs/storages/inLocalStorage/SplitsCacheInLocal.js +14 -7
  22. package/cjs/storages/inLocalStorage/index.js +1 -6
  23. package/cjs/storages/inMemory/InMemoryStorageCS.js +4 -16
  24. package/cjs/storages/inMemory/SegmentsCacheInMemory.js +3 -4
  25. package/cjs/storages/inMemory/SplitsCacheInMemory.js +2 -3
  26. package/cjs/storages/inMemory/UniqueKeysCacheInMemory.js +2 -3
  27. package/cjs/storages/inMemory/UniqueKeysCacheInMemoryCS.js +2 -3
  28. package/cjs/storages/inRedis/RedisAdapter.js +3 -4
  29. package/cjs/storages/inRedis/SplitsCacheInRedis.js +1 -1
  30. package/cjs/storages/inRedis/TelemetryCacheInRedis.js +3 -4
  31. package/cjs/storages/inRedis/UniqueKeysCacheInRedis.js +1 -2
  32. package/cjs/storages/pluggable/SplitsCachePluggable.js +1 -1
  33. package/cjs/storages/pluggable/TelemetryCachePluggable.js +6 -7
  34. package/cjs/storages/pluggable/UniqueKeysCachePluggable.js +1 -2
  35. package/cjs/storages/pluggable/inMemoryWrapper.js +7 -8
  36. package/cjs/storages/pluggable/index.js +32 -37
  37. package/cjs/sync/offline/syncTasks/fromObjectSyncTask.js +7 -2
  38. package/cjs/sync/polling/pollingManagerSS.js +3 -3
  39. package/cjs/sync/polling/updaters/splitChangesUpdater.js +13 -5
  40. package/cjs/sync/streaming/parseUtils.js +0 -1
  41. package/cjs/sync/streaming/pushManager.js +2 -3
  42. package/cjs/trackers/eventTracker.js +9 -11
  43. package/cjs/trackers/impressionsTracker.js +13 -15
  44. package/cjs/trackers/uniqueKeysTracker.js +3 -5
  45. package/cjs/utils/LRUCache/index.js +1 -2
  46. package/cjs/utils/constants/browser.js +1 -4
  47. package/cjs/utils/lang/index.js +6 -9
  48. package/cjs/utils/lang/objectAssign.js +12 -77
  49. package/cjs/utils/lang/sets.js +3 -110
  50. package/cjs/utils/settingsValidation/index.js +0 -9
  51. package/cjs/utils/settingsValidation/logger/builtinLogger.js +1 -2
  52. package/cjs/utils/settingsValidation/storage/storageCS.js +12 -1
  53. package/esm/evaluator/index.js +3 -3
  54. package/esm/evaluator/matchers/semver_inlist.js +1 -2
  55. package/esm/evaluator/matchers/whitelist.js +1 -2
  56. package/esm/listeners/browser.js +1 -2
  57. package/esm/logger/browser/DebugLogger.js +1 -2
  58. package/esm/logger/browser/ErrorLogger.js +1 -2
  59. package/esm/logger/browser/InfoLogger.js +1 -2
  60. package/esm/logger/browser/WarnLogger.js +1 -2
  61. package/esm/logger/index.js +1 -2
  62. package/esm/readiness/readinessManager.js +5 -7
  63. package/esm/sdkClient/clientCS.js +5 -8
  64. package/esm/sdkClient/sdkClientMethodCS.js +5 -8
  65. package/esm/sdkFactory/index.js +11 -34
  66. package/esm/services/decorateHeaders.js +1 -2
  67. package/esm/storages/AbstractSplitsCacheAsync.js +7 -0
  68. package/esm/storages/AbstractSplitsCacheSync.js +7 -0
  69. package/esm/storages/KeyBuilderCS.js +0 -9
  70. package/esm/storages/dataLoader.js +30 -61
  71. package/esm/storages/inLocalStorage/MySegmentsCacheInLocal.js +1 -21
  72. package/esm/storages/inLocalStorage/SplitsCacheInLocal.js +14 -7
  73. package/esm/storages/inLocalStorage/index.js +2 -7
  74. package/esm/storages/inMemory/InMemoryStorageCS.js +4 -16
  75. package/esm/storages/inMemory/SegmentsCacheInMemory.js +3 -4
  76. package/esm/storages/inMemory/SplitsCacheInMemory.js +2 -3
  77. package/esm/storages/inMemory/UniqueKeysCacheInMemory.js +2 -3
  78. package/esm/storages/inMemory/UniqueKeysCacheInMemoryCS.js +2 -3
  79. package/esm/storages/inRedis/RedisAdapter.js +3 -4
  80. package/esm/storages/inRedis/SplitsCacheInRedis.js +2 -2
  81. package/esm/storages/inRedis/TelemetryCacheInRedis.js +3 -4
  82. package/esm/storages/inRedis/UniqueKeysCacheInRedis.js +1 -2
  83. package/esm/storages/pluggable/SplitsCachePluggable.js +2 -2
  84. package/esm/storages/pluggable/TelemetryCachePluggable.js +6 -7
  85. package/esm/storages/pluggable/UniqueKeysCachePluggable.js +1 -2
  86. package/esm/storages/pluggable/inMemoryWrapper.js +7 -8
  87. package/esm/storages/pluggable/index.js +32 -37
  88. package/esm/sync/offline/syncTasks/fromObjectSyncTask.js +8 -3
  89. package/esm/sync/polling/pollingManagerSS.js +3 -3
  90. package/esm/sync/polling/updaters/splitChangesUpdater.js +14 -6
  91. package/esm/sync/streaming/parseUtils.js +0 -1
  92. package/esm/sync/streaming/pushManager.js +2 -3
  93. package/esm/trackers/eventTracker.js +9 -11
  94. package/esm/trackers/impressionsTracker.js +13 -15
  95. package/esm/trackers/uniqueKeysTracker.js +3 -5
  96. package/esm/utils/LRUCache/index.js +1 -2
  97. package/esm/utils/constants/browser.js +0 -3
  98. package/esm/utils/lang/index.js +6 -9
  99. package/esm/utils/lang/objectAssign.js +12 -77
  100. package/esm/utils/lang/sets.js +2 -107
  101. package/esm/utils/settingsValidation/index.js +0 -9
  102. package/esm/utils/settingsValidation/logger/builtinLogger.js +1 -2
  103. package/esm/utils/settingsValidation/storage/storageCS.js +10 -0
  104. package/package.json +2 -2
  105. package/src/evaluator/index.ts +5 -5
  106. package/src/evaluator/matchers/semver_inlist.ts +1 -2
  107. package/src/evaluator/matchers/whitelist.ts +1 -3
  108. package/src/listeners/browser.ts +1 -2
  109. package/src/logger/browser/DebugLogger.ts +1 -2
  110. package/src/logger/browser/ErrorLogger.ts +1 -2
  111. package/src/logger/browser/InfoLogger.ts +1 -2
  112. package/src/logger/browser/WarnLogger.ts +1 -2
  113. package/src/logger/index.ts +3 -4
  114. package/src/readiness/readinessManager.ts +7 -9
  115. package/src/readiness/types.ts +0 -1
  116. package/src/sdkClient/clientCS.ts +5 -8
  117. package/src/sdkClient/sdkClientMethodCS.ts +3 -6
  118. package/src/sdkFactory/index.ts +12 -37
  119. package/src/sdkFactory/types.ts +1 -4
  120. package/src/services/decorateHeaders.ts +1 -2
  121. package/src/storages/AbstractSplitsCacheAsync.ts +9 -2
  122. package/src/storages/AbstractSplitsCacheSync.ts +9 -2
  123. package/src/storages/KeyBuilderCS.ts +0 -13
  124. package/src/storages/dataLoader.ts +32 -62
  125. package/src/storages/inLocalStorage/MySegmentsCacheInLocal.ts +1 -21
  126. package/src/storages/inLocalStorage/SplitsCacheInLocal.ts +16 -8
  127. package/src/storages/inLocalStorage/index.ts +2 -8
  128. package/src/storages/inMemory/InMemoryStorageCS.ts +4 -19
  129. package/src/storages/inMemory/SegmentsCacheInMemory.ts +4 -5
  130. package/src/storages/inMemory/SplitsCacheInMemory.ts +4 -5
  131. package/src/storages/inMemory/UniqueKeysCacheInMemory.ts +4 -5
  132. package/src/storages/inMemory/UniqueKeysCacheInMemoryCS.ts +4 -5
  133. package/src/storages/inRedis/RedisAdapter.ts +4 -5
  134. package/src/storages/inRedis/SplitsCacheInRedis.ts +3 -3
  135. package/src/storages/inRedis/TelemetryCacheInRedis.ts +3 -4
  136. package/src/storages/inRedis/UniqueKeysCacheInRedis.ts +1 -2
  137. package/src/storages/pluggable/SegmentsCachePluggable.ts +0 -1
  138. package/src/storages/pluggable/SplitsCachePluggable.ts +3 -3
  139. package/src/storages/pluggable/TelemetryCachePluggable.ts +6 -7
  140. package/src/storages/pluggable/UniqueKeysCachePluggable.ts +1 -2
  141. package/src/storages/pluggable/inMemoryWrapper.ts +8 -9
  142. package/src/storages/pluggable/index.ts +33 -38
  143. package/src/storages/types.ts +9 -6
  144. package/src/sync/offline/syncTasks/fromObjectSyncTask.ts +7 -3
  145. package/src/sync/polling/pollingManagerSS.ts +2 -3
  146. package/src/sync/polling/updaters/splitChangesUpdater.ts +15 -8
  147. package/src/sync/streaming/parseUtils.ts +0 -1
  148. package/src/sync/streaming/pushManager.ts +3 -4
  149. package/src/sync/submitters/types.ts +3 -4
  150. package/src/trackers/eventTracker.ts +7 -10
  151. package/src/trackers/impressionsTracker.ts +9 -12
  152. package/src/trackers/types.ts +0 -1
  153. package/src/trackers/uniqueKeysTracker.ts +4 -6
  154. package/src/types.ts +9 -18
  155. package/src/utils/LRUCache/index.ts +2 -3
  156. package/src/utils/constants/browser.ts +0 -4
  157. package/src/utils/lang/index.ts +6 -7
  158. package/src/utils/lang/objectAssign.ts +13 -92
  159. package/src/utils/lang/sets.ts +3 -125
  160. package/src/utils/settingsValidation/index.ts +0 -10
  161. package/src/utils/settingsValidation/logger/builtinLogger.ts +1 -2
  162. package/src/utils/settingsValidation/storage/storageCS.ts +13 -0
  163. package/src/utils/settingsValidation/types.ts +0 -2
  164. package/types/logger/index.d.ts +1 -2
  165. package/types/readiness/types.d.ts +0 -1
  166. package/types/sdkClient/clientCS.d.ts +2 -3
  167. package/types/sdkFactory/types.d.ts +1 -3
  168. package/types/storages/AbstractSplitsCacheAsync.d.ts +6 -2
  169. package/types/storages/AbstractSplitsCacheSync.d.ts +6 -2
  170. package/types/storages/KeyBuilderCS.d.ts +0 -2
  171. package/types/storages/dataLoader.d.ts +6 -17
  172. package/types/storages/inLocalStorage/SplitsCacheInLocal.d.ts +7 -2
  173. package/types/storages/inMemory/SplitsCacheInMemory.d.ts +1 -2
  174. package/types/storages/inMemory/UniqueKeysCacheInMemory.d.ts +2 -3
  175. package/types/storages/inRedis/SplitsCacheInRedis.d.ts +1 -2
  176. package/types/storages/pluggable/SplitsCachePluggable.d.ts +1 -2
  177. package/types/storages/pluggable/inMemoryWrapper.d.ts +1 -2
  178. package/types/storages/types.d.ts +7 -6
  179. package/types/sync/polling/updaters/splitChangesUpdater.d.ts +1 -2
  180. package/types/sync/submitters/types.d.ts +3 -4
  181. package/types/trackers/eventTracker.d.ts +1 -1
  182. package/types/trackers/impressionsTracker.d.ts +1 -1
  183. package/types/trackers/types.d.ts +0 -1
  184. package/types/types.d.ts +9 -17
  185. package/types/utils/LRUCache/index.d.ts +1 -2
  186. package/types/utils/constants/browser.d.ts +0 -2
  187. package/types/utils/lang/objectAssign.d.ts +3 -0
  188. package/types/utils/lang/sets.d.ts +1 -61
  189. package/types/utils/settingsValidation/index.d.ts +0 -1
  190. package/types/utils/settingsValidation/storage/storageCS.d.ts +5 -0
  191. package/types/utils/settingsValidation/types.d.ts +0 -2
  192. package/cjs/integrations/browser.js +0 -31
  193. package/cjs/integrations/ga/GaToSplit.js +0 -257
  194. package/cjs/integrations/ga/GoogleAnalyticsToSplit.js +0 -14
  195. package/cjs/integrations/ga/SplitToGa.js +0 -123
  196. package/cjs/integrations/ga/SplitToGoogleAnalytics.js +0 -14
  197. package/cjs/integrations/ga/types.js +0 -2
  198. package/cjs/sdkClient/sdkClientMethodCSWithTT.js +0 -79
  199. package/cjs/utils/lang/maps.js +0 -96
  200. package/esm/integrations/browser.js +0 -27
  201. package/esm/integrations/ga/GaToSplit.js +0 -250
  202. package/esm/integrations/ga/GoogleAnalyticsToSplit.js +0 -10
  203. package/esm/integrations/ga/SplitToGa.js +0 -120
  204. package/esm/integrations/ga/SplitToGoogleAnalytics.js +0 -10
  205. package/esm/integrations/ga/types.js +0 -1
  206. package/esm/sdkClient/sdkClientMethodCSWithTT.js +0 -75
  207. package/esm/utils/lang/maps.js +0 -92
  208. package/src/integrations/browser.ts +0 -35
  209. package/src/integrations/ga/GaToSplit.ts +0 -299
  210. package/src/integrations/ga/GoogleAnalyticsToSplit.ts +0 -14
  211. package/src/integrations/ga/SplitToGa.ts +0 -135
  212. package/src/integrations/ga/SplitToGoogleAnalytics.ts +0 -14
  213. package/src/integrations/ga/autoRequire.js +0 -33
  214. package/src/integrations/ga/types.ts +0 -153
  215. package/src/sdkClient/sdkClientMethodCSWithTT.ts +0 -101
  216. package/src/utils/lang/maps.ts +0 -108
@@ -1,101 +0,0 @@
1
- import { clientCSDecorator } from './clientCS';
2
- import { SplitIO } from '../types';
3
- import { validateKey } from '../utils/inputValidation/key';
4
- import { validateTrafficType } from '../utils/inputValidation/trafficType';
5
- import { getMatching, keyParser } from '../utils/key';
6
- import { sdkClientFactory } from './sdkClient';
7
- import { ISyncManagerCS } from '../sync/types';
8
- import { objectAssign } from '../utils/lang/objectAssign';
9
- import { RETRIEVE_CLIENT_DEFAULT, NEW_SHARED_CLIENT, RETRIEVE_CLIENT_EXISTING, LOG_PREFIX_CLIENT_INSTANTIATION } from '../logger/constants';
10
- import { SDK_SEGMENTS_ARRIVED } from '../readiness/constants';
11
- import { ISdkFactoryContext } from '../sdkFactory/types';
12
- import { buildInstanceId } from './identity';
13
-
14
- /**
15
- * Factory of client method for the client-side (browser) variant of the Isomorphic JS SDK,
16
- * where clients can have a bound TT for the track method, which is provided via the settings
17
- * (default client) or the client method (shared clients).
18
- */
19
- export function sdkClientMethodCSFactory(params: ISdkFactoryContext): (key?: SplitIO.SplitKey, trafficType?: string) => SplitIO.ICsClient {
20
- const { clients, storage, syncManager, sdkReadinessManager, settings: { core: { key, trafficType }, log }, whenInit } = params;
21
-
22
- const mainClientInstance = clientCSDecorator(
23
- log,
24
- sdkClientFactory(params) as SplitIO.IClient,
25
- key,
26
- trafficType
27
- );
28
-
29
- const parsedDefaultKey = keyParser(key);
30
- const defaultInstanceId = buildInstanceId(parsedDefaultKey, trafficType);
31
-
32
- // Cache instances created per factory.
33
- clients[defaultInstanceId] = mainClientInstance;
34
-
35
- return function client(key?: SplitIO.SplitKey, trafficType?: string) {
36
- if (key === undefined) {
37
- log.debug(RETRIEVE_CLIENT_DEFAULT);
38
- return mainClientInstance;
39
- }
40
-
41
- // Validate the key value
42
- const validKey = validateKey(log, key, LOG_PREFIX_CLIENT_INSTANTIATION);
43
- if (validKey === false) {
44
- throw new Error('Shared Client needs a valid key.');
45
- }
46
-
47
- let validTrafficType;
48
- if (trafficType !== undefined) {
49
- validTrafficType = validateTrafficType(log, trafficType, LOG_PREFIX_CLIENT_INSTANTIATION);
50
- if (validTrafficType === false) {
51
- throw new Error('Shared Client needs a valid traffic type or no traffic type at all.');
52
- }
53
- }
54
- const instanceId = buildInstanceId(validKey, validTrafficType);
55
-
56
- if (!clients[instanceId]) {
57
- const matchingKey = getMatching(validKey);
58
-
59
- const sharedSdkReadiness = sdkReadinessManager.shared();
60
- const sharedStorage = storage.shared && storage.shared(matchingKey, (err) => {
61
- if (err) {
62
- sharedSdkReadiness.readinessManager.timeout();
63
- return;
64
- }
65
- // Emit SDK_READY in consumer mode for shared clients
66
- sharedSdkReadiness.readinessManager.segments.emit(SDK_SEGMENTS_ARRIVED);
67
- });
68
-
69
- // 3 possibilities:
70
- // - Standalone mode: both syncManager and sharedSyncManager are defined
71
- // - Consumer mode: both syncManager and sharedSyncManager are undefined
72
- // - Consumer partial mode: syncManager is defined (only for submitters) but sharedSyncManager is undefined
73
- // @ts-ignore
74
- const sharedSyncManager = syncManager && sharedStorage && (syncManager as ISyncManagerCS).shared(matchingKey, sharedSdkReadiness.readinessManager, sharedStorage);
75
-
76
- // As shared clients reuse all the storage information, we don't need to check here if we
77
- // will use offline or online mode. We should stick with the original decision.
78
- clients[instanceId] = clientCSDecorator(
79
- log,
80
- sdkClientFactory(objectAssign({}, params, {
81
- sdkReadinessManager: sharedSdkReadiness,
82
- storage: sharedStorage || storage,
83
- syncManager: sharedSyncManager,
84
- }), true) as SplitIO.IClient,
85
- validKey,
86
- validTrafficType
87
- );
88
-
89
- whenInit(() => {
90
- sharedSdkReadiness.readinessManager.init();
91
- sharedSyncManager && sharedSyncManager.start();
92
- });
93
-
94
- log.info(NEW_SHARED_CLIENT);
95
- } else {
96
- log.debug(RETRIEVE_CLIENT_EXISTING);
97
- }
98
-
99
- return clients[instanceId] as SplitIO.ICsClient;
100
- };
101
- }
@@ -1,108 +0,0 @@
1
- /**
2
- * Map implementation based on es6-map polyfill (https://github.com/medikoo/es6-map/blob/master/polyfill.js),
3
- * with the minimal features used by the SDK.
4
-
5
- Copyright (C) 2013 Mariusz Nowak (www.medikoo.com)
6
-
7
- Permission is hereby granted, free of charge, to any person obtaining a copy
8
- of this software and associated documentation files (the "Software"), to deal
9
- in the Software without restriction, including without limitation the rights
10
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
- copies of the Software, and to permit persons to whom the Software is
12
- furnished to do so, subject to the following conditions:
13
-
14
- The above copyright notice and this permission notice shall be included in
15
- all copies or substantial portions of the Software.
16
-
17
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
- THE SOFTWARE.
24
- **/
25
-
26
- export interface IMap<K, V> {
27
- clear(): void;
28
- delete(key: K): boolean;
29
- forEach(callbackfn: (value: V, key: K, map: Map<K, V>) => void, thisArg?: any): void;
30
- get(key: K): V | undefined;
31
- has(key: K): boolean;
32
- set(key: K, value: V): this;
33
- readonly size: number;
34
- }
35
-
36
- export class MapPoly<K, V> implements IMap<K, V>{
37
- private __mapKeysData__: K[] = [];
38
- private __mapValuesData__: V[] = [];
39
-
40
- // unlike ES6 `Map`, it only accepts an array as first argument iterable
41
- constructor(entries?: readonly (readonly [K, V])[] | null) {
42
- if (Array.isArray(entries)) entries.forEach(entry => { this.set(entry[0], entry[1]); });
43
- }
44
-
45
- clear() {
46
- if (!this.__mapKeysData__.length) return;
47
- this.__mapKeysData__.length = 0;
48
- this.__mapValuesData__.length = 0;
49
- }
50
-
51
- delete(key: K) {
52
- const index = this.__mapKeysData__.indexOf(key);
53
- if (index === -1) return false;
54
- this.__mapKeysData__.splice(index, 1);
55
- this.__mapValuesData__.splice(index, 1);
56
- return true;
57
- }
58
-
59
- forEach(callbackfn: (value: V, key: K, map: Map<K, V>) => void, thisArg?: any) {
60
- for (let i = 0; i < this.__mapKeysData__.length; i++) {
61
- callbackfn.call(thisArg, this.__mapValuesData__[i], this.__mapKeysData__[i], this as any);
62
- }
63
- }
64
-
65
- get(key: K) {
66
- const index = this.__mapKeysData__.indexOf(key);
67
- if (index === -1) return;
68
- return this.__mapValuesData__[index];
69
- }
70
-
71
- has(key: K): boolean {
72
- return this.__mapKeysData__.indexOf(key) !== -1;
73
- }
74
-
75
- set(key: K, value: V) {
76
- let index = this.__mapKeysData__.indexOf(key);
77
- if (index === -1) index = this.__mapKeysData__.push(key) - 1;
78
- this.__mapValuesData__[index] = value;
79
- return this;
80
- }
81
-
82
- get size() {
83
- return this.__mapKeysData__.length;
84
- }
85
-
86
- }
87
-
88
- interface IMapConstructor {
89
- new(): IMap<any, any>;
90
- new <K, V>(entries?: readonly (readonly [K, V])[] | null): IMap<K, V>;
91
- readonly prototype: IMap<any, any>;
92
- }
93
-
94
- /**
95
- * return the Map constructor to use. If native Map is not available or it doesn't support the required features (e.g., IE11),
96
- * a ponyfill with minimal features is returned instead.
97
- *
98
- * Exported for testing purposes only.
99
- */
100
- export function __getMapConstructor(): IMapConstructor {
101
- // eslint-disable-next-line compat/compat
102
- if (typeof Array.from === 'function' && typeof Map === 'function' && Map.prototype && Map.prototype.values) {
103
- return Map;
104
- }
105
- return MapPoly;
106
- }
107
-
108
- export const _Map = __getMapConstructor();