@firebase/util 1.6.1 → 1.6.2-canary.13550089f

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.
@@ -1027,6 +1027,34 @@ function isObject(thing) {
1027
1027
  return thing !== null && typeof thing === 'object';
1028
1028
  }
1029
1029
 
1030
+ /**
1031
+ * @license
1032
+ * Copyright 2022 Google LLC
1033
+ *
1034
+ * Licensed under the Apache License, Version 2.0 (the "License");
1035
+ * you may not use this file except in compliance with the License.
1036
+ * You may obtain a copy of the License at
1037
+ *
1038
+ * http://www.apache.org/licenses/LICENSE-2.0
1039
+ *
1040
+ * Unless required by applicable law or agreed to in writing, software
1041
+ * distributed under the License is distributed on an "AS IS" BASIS,
1042
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1043
+ * See the License for the specific language governing permissions and
1044
+ * limitations under the License.
1045
+ */
1046
+ /**
1047
+ * Rejects if the given promise doesn't resolve in timeInMS milliseconds.
1048
+ * @internal
1049
+ */
1050
+ function promiseWithTimeout(promise, timeInMS) {
1051
+ if (timeInMS === void 0) { timeInMS = 2000; }
1052
+ var deferredPromise = new Deferred();
1053
+ setTimeout(function () { return deferredPromise.reject('timeout!'); }, timeInMS);
1054
+ promise.then(deferredPromise.resolve, deferredPromise.reject);
1055
+ return deferredPromise.promise;
1056
+ }
1057
+
1030
1058
  /**
1031
1059
  * @license
1032
1060
  * Copyright 2017 Google LLC
@@ -1751,6 +1779,34 @@ var stringLength = function (str) {
1751
1779
  return p;
1752
1780
  };
1753
1781
 
1782
+ /**
1783
+ * @license
1784
+ * Copyright 2022 Google LLC
1785
+ *
1786
+ * Licensed under the Apache License, Version 2.0 (the "License");
1787
+ * you may not use this file except in compliance with the License.
1788
+ * You may obtain a copy of the License at
1789
+ *
1790
+ * http://www.apache.org/licenses/LICENSE-2.0
1791
+ *
1792
+ * Unless required by applicable law or agreed to in writing, software
1793
+ * distributed under the License is distributed on an "AS IS" BASIS,
1794
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1795
+ * See the License for the specific language governing permissions and
1796
+ * limitations under the License.
1797
+ */
1798
+ /**
1799
+ * Copied from https://stackoverflow.com/a/2117523
1800
+ * Generates a new uuid.
1801
+ * @public
1802
+ */
1803
+ var uuidv4 = function () {
1804
+ return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
1805
+ var r = (Math.random() * 16) | 0, v = c === 'x' ? r : (r & 0x3) | 0x8;
1806
+ return v.toString(16);
1807
+ });
1808
+ };
1809
+
1754
1810
  /**
1755
1811
  * @license
1756
1812
  * Copyright 2019 Google LLC
@@ -1887,5 +1943,5 @@ function getModularInstance(service) {
1887
1943
  }
1888
1944
  }
1889
1945
 
1890
- export { CONSTANTS, Deferred, ErrorFactory, FirebaseError, MAX_VALUE_MILLIS, RANDOM_FACTOR, Sha1, areCookiesEnabled, assert, assertionError, async, base64, base64Decode, base64Encode, base64urlEncodeWithoutPadding, calculateBackoffMillis, contains, createMockUserToken, createSubscribe, decode, deepCopy, deepEqual, deepExtend, errorPrefix, extractQuerystring, getGlobal, getModularInstance, getUA, isAdmin, isBrowser, isBrowserExtension, isElectron, isEmpty, isIE, isIndexedDBAvailable, isMobileCordova, isNode, isNodeSdk, isReactNative, isSafari, isUWP, isValidFormat, isValidTimestamp, issuedAtTime, jsonEval, map, ordinal, querystring, querystringDecode, safeGet, stringLength, stringToByteArray, stringify, validateArgCount, validateCallback, validateContextObject, validateIndexedDBOpenable, validateNamespace };
1946
+ export { CONSTANTS, Deferred, ErrorFactory, FirebaseError, MAX_VALUE_MILLIS, RANDOM_FACTOR, Sha1, areCookiesEnabled, assert, assertionError, async, base64, base64Decode, base64Encode, base64urlEncodeWithoutPadding, calculateBackoffMillis, contains, createMockUserToken, createSubscribe, decode, deepCopy, deepEqual, deepExtend, errorPrefix, extractQuerystring, getGlobal, getModularInstance, getUA, isAdmin, isBrowser, isBrowserExtension, isElectron, isEmpty, isIE, isIndexedDBAvailable, isMobileCordova, isNode, isNodeSdk, isReactNative, isSafari, isUWP, isValidFormat, isValidTimestamp, issuedAtTime, jsonEval, map, ordinal, promiseWithTimeout, querystring, querystringDecode, safeGet, stringLength, stringToByteArray, stringify, uuidv4, validateArgCount, validateCallback, validateContextObject, validateIndexedDBOpenable, validateNamespace };
1891
1947
  //# sourceMappingURL=index.esm5.js.map