@firebase/util 1.6.1 → 1.6.2-canary.69e2ee064

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @firebase/util
2
2
 
3
+ ## 1.6.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`efe2000fc`](https://github.com/firebase/firebase-js-sdk/commit/efe2000fc499e2c85c4e5e0fef6741ff3bad2eb0) [#6363](https://github.com/firebase/firebase-js-sdk/pull/6363) - Extract uuid function into @firebase/util
8
+
3
9
  ## 1.6.1
4
10
 
5
11
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -30,6 +30,7 @@ export * from './src/sha1';
30
30
  export * from './src/subscribe';
31
31
  export * from './src/validation';
32
32
  export * from './src/utf8';
33
+ export * from './src/uuid';
33
34
  export * from './src/exponential_backoff';
34
35
  export * from './src/formatters';
35
36
  export * from './src/compat';
@@ -774,7 +774,7 @@ function getGlobal() {
774
774
  *
775
775
  * catch (e) {
776
776
  * assert(e.message === "Could not find file: foo.txt.");
777
- * if (e.code === 'service/file-not-found') {
777
+ * if ((e as FirebaseError)?.code === 'service/file-not-found') {
778
778
  * console.log("Could not read file: " + e['file']);
779
779
  * }
780
780
  * }
@@ -1761,6 +1761,34 @@ const stringLength = function (str) {
1761
1761
  return p;
1762
1762
  };
1763
1763
 
1764
+ /**
1765
+ * @license
1766
+ * Copyright 2022 Google LLC
1767
+ *
1768
+ * Licensed under the Apache License, Version 2.0 (the "License");
1769
+ * you may not use this file except in compliance with the License.
1770
+ * You may obtain a copy of the License at
1771
+ *
1772
+ * http://www.apache.org/licenses/LICENSE-2.0
1773
+ *
1774
+ * Unless required by applicable law or agreed to in writing, software
1775
+ * distributed under the License is distributed on an "AS IS" BASIS,
1776
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1777
+ * See the License for the specific language governing permissions and
1778
+ * limitations under the License.
1779
+ */
1780
+ /**
1781
+ * Copied from https://stackoverflow.com/a/2117523
1782
+ * Generates a new uuid.
1783
+ * @public
1784
+ */
1785
+ const uuidv4 = function () {
1786
+ return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => {
1787
+ const r = (Math.random() * 16) | 0, v = c === 'x' ? r : (r & 0x3) | 0x8;
1788
+ return v.toString(16);
1789
+ });
1790
+ };
1791
+
1764
1792
  /**
1765
1793
  * @license
1766
1794
  * Copyright 2019 Google LLC
@@ -1895,5 +1923,5 @@ function getModularInstance(service) {
1895
1923
  }
1896
1924
  }
1897
1925
 
1898
- 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 };
1926
+ 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, uuidv4, validateArgCount, validateCallback, validateContextObject, validateIndexedDBOpenable, validateNamespace };
1899
1927
  //# sourceMappingURL=index.esm2017.js.map