react-native-google-mobile-ads 12.1.0 → 12.1.2

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 (83) hide show
  1. package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsBannerAdViewManager.java +25 -22
  2. package/lib/commonjs/ads/MobileAd.js +1 -1
  3. package/lib/commonjs/ads/MobileAd.js.map +1 -1
  4. package/lib/commonjs/common/index.js +1 -140
  5. package/lib/commonjs/common/index.js.map +1 -1
  6. package/lib/commonjs/common/validate.js +0 -89
  7. package/lib/commonjs/common/validate.js.map +1 -1
  8. package/lib/commonjs/version.js +1 -1
  9. package/lib/module/ads/MobileAd.js +1 -1
  10. package/lib/module/ads/MobileAd.js.map +1 -1
  11. package/lib/module/common/index.js +1 -78
  12. package/lib/module/common/index.js.map +1 -1
  13. package/lib/module/common/validate.js +0 -81
  14. package/lib/module/common/validate.js.map +1 -1
  15. package/lib/module/version.js +1 -1
  16. package/lib/typescript/ads/MobileAd.d.ts.map +1 -1
  17. package/lib/typescript/common/index.d.ts +0 -26
  18. package/lib/typescript/common/index.d.ts.map +1 -1
  19. package/lib/typescript/common/validate.d.ts +0 -35
  20. package/lib/typescript/common/validate.d.ts.map +1 -1
  21. package/lib/typescript/index.d.ts +1 -1
  22. package/lib/typescript/version.d.ts +1 -1
  23. package/package.json +1 -1
  24. package/src/ads/MobileAd.ts +1 -0
  25. package/src/common/index.ts +1 -81
  26. package/src/common/validate.ts +0 -98
  27. package/src/version.ts +1 -1
  28. package/lib/commonjs/common/Base64.js +0 -102
  29. package/lib/commonjs/common/Base64.js.map +0 -1
  30. package/lib/commonjs/common/MutatableParams.js +0 -50
  31. package/lib/commonjs/common/MutatableParams.js.map +0 -1
  32. package/lib/commonjs/common/ReferenceBase.js +0 -49
  33. package/lib/commonjs/common/ReferenceBase.js.map +0 -1
  34. package/lib/commonjs/common/deeps.js +0 -85
  35. package/lib/commonjs/common/deeps.js.map +0 -1
  36. package/lib/commonjs/common/id.js +0 -72
  37. package/lib/commonjs/common/id.js.map +0 -1
  38. package/lib/commonjs/common/path.js +0 -125
  39. package/lib/commonjs/common/path.js.map +0 -1
  40. package/lib/commonjs/common/promise.js +0 -64
  41. package/lib/commonjs/common/promise.js.map +0 -1
  42. package/lib/commonjs/common/serialize.js +0 -48
  43. package/lib/commonjs/common/serialize.js.map +0 -1
  44. package/lib/module/common/Base64.js +0 -93
  45. package/lib/module/common/Base64.js.map +0 -1
  46. package/lib/module/common/MutatableParams.js +0 -43
  47. package/lib/module/common/MutatableParams.js.map +0 -1
  48. package/lib/module/common/ReferenceBase.js +0 -42
  49. package/lib/module/common/ReferenceBase.js.map +0 -1
  50. package/lib/module/common/deeps.js +0 -79
  51. package/lib/module/common/deeps.js.map +0 -1
  52. package/lib/module/common/id.js +0 -65
  53. package/lib/module/common/id.js.map +0 -1
  54. package/lib/module/common/path.js +0 -110
  55. package/lib/module/common/path.js.map +0 -1
  56. package/lib/module/common/promise.js +0 -58
  57. package/lib/module/common/promise.js.map +0 -1
  58. package/lib/module/common/serialize.js +0 -41
  59. package/lib/module/common/serialize.js.map +0 -1
  60. package/lib/typescript/common/Base64.d.ts +0 -15
  61. package/lib/typescript/common/Base64.d.ts.map +0 -1
  62. package/lib/typescript/common/MutatableParams.d.ts +0 -10
  63. package/lib/typescript/common/MutatableParams.d.ts.map +0 -1
  64. package/lib/typescript/common/ReferenceBase.d.ts +0 -12
  65. package/lib/typescript/common/ReferenceBase.d.ts.map +0 -1
  66. package/lib/typescript/common/deeps.d.ts +0 -19
  67. package/lib/typescript/common/deeps.d.ts.map +0 -1
  68. package/lib/typescript/common/id.d.ts +0 -12
  69. package/lib/typescript/common/id.d.ts.map +0 -1
  70. package/lib/typescript/common/path.d.ts +0 -44
  71. package/lib/typescript/common/path.d.ts.map +0 -1
  72. package/lib/typescript/common/promise.d.ts +0 -14
  73. package/lib/typescript/common/promise.d.ts.map +0 -1
  74. package/lib/typescript/common/serialize.d.ts +0 -6
  75. package/lib/typescript/common/serialize.d.ts.map +0 -1
  76. package/src/common/Base64.ts +0 -114
  77. package/src/common/MutatableParams.ts +0 -50
  78. package/src/common/ReferenceBase.ts +0 -45
  79. package/src/common/deeps.ts +0 -88
  80. package/src/common/id.ts +0 -74
  81. package/src/common/path.ts +0 -114
  82. package/src/common/promise.ts +0 -66
  83. package/src/common/serialize.ts +0 -43
@@ -1,114 +0,0 @@
1
- /* eslint-disable no-bitwise */
2
- /* global Blob, FileReader */
3
- /*
4
- * Copyright (c) 2016-present Invertase Limited & Contributors
5
- *
6
- * Licensed under the Apache License, Version 2.0 (the "License");
7
- * you may not use this library except in compliance with the License.
8
- * You may obtain a copy of the License at
9
- *
10
- * http://www.apache.org/licenses/LICENSE-2.0
11
- *
12
- * Unless required by applicable law or agreed to in writing, software
13
- * distributed under the License is distributed on an "AS IS" BASIS,
14
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- * See the License for the specific language governing permissions and
16
- * limitations under the License.
17
- *
18
- */
19
-
20
- import binaryToBase64 from 'react-native/Libraries/Utilities/binaryToBase64';
21
- import { promiseDefer } from './promise';
22
-
23
- const CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
24
-
25
- /**
26
- * window.btoa
27
- */
28
- export function btoa(input: string) {
29
- let map;
30
- let i = 0;
31
- let block = 0;
32
- let output = '';
33
-
34
- for (
35
- block = 0, i = 0, map = CHARS;
36
- input.charAt(i | 0) || ((map = '='), i % 1);
37
- output += map.charAt(63 & (block >> (8 - (i % 1) * 8)))
38
- ) {
39
- const charCode = input.charCodeAt((i += 3 / 4));
40
-
41
- if (charCode > 0xff) {
42
- throw new Error(
43
- "'RNFirebase.Base64.btoa' failed: The string to be encoded contains characters outside of the Latin1 range.",
44
- );
45
- }
46
-
47
- block = (block << 8) | charCode;
48
- }
49
-
50
- return output;
51
- }
52
-
53
- /**
54
- * window.atob
55
- */
56
- export function atob(input: string) {
57
- let i = 0;
58
- let bc = 0;
59
- let bs = 0;
60
- let buffer;
61
- let output = '';
62
-
63
- const str = input.replace(/[=]+$/, '');
64
-
65
- if (str.length % 4 === 1) {
66
- throw new Error(
67
- "'RNFirebase.Base64.atob' failed: The string to be decoded is not correctly encoded.",
68
- );
69
- }
70
-
71
- for (
72
- bc = 0, bs = 0, i = 0;
73
- (buffer = str.charAt(i++));
74
- ~buffer && ((bs = bc % 4 ? bs * 64 + buffer : buffer), bc++ % 4)
75
- ? (output += String.fromCharCode(255 & (bs >> ((-2 * bc) & 6))))
76
- : 0
77
- ) {
78
- buffer = CHARS.indexOf(buffer);
79
- }
80
-
81
- return output;
82
- }
83
-
84
- /**
85
- * Converts a Blob, ArrayBuffer or Uint8Array to a base64 string.
86
- */
87
- export function fromData(data: Blob | ArrayBuffer | Uint8Array) {
88
- if (data instanceof Blob) {
89
- const fileReader = new FileReader();
90
- const { resolve, reject, promise } = promiseDefer();
91
-
92
- fileReader.readAsDataURL(data);
93
-
94
- fileReader.onloadend = function onloadend() {
95
- resolve({ string: fileReader.result, format: 'data_url' });
96
- };
97
-
98
- fileReader.onerror = function onerror(event) {
99
- fileReader.abort();
100
- reject(event);
101
- };
102
-
103
- return promise;
104
- }
105
-
106
- if (data instanceof ArrayBuffer || data instanceof Uint8Array) {
107
- return Promise.resolve({
108
- string: binaryToBase64(data),
109
- format: 'base64',
110
- });
111
- }
112
-
113
- throw new Error("'RNFirebase.Base64.fromData' failed: Unknown data type.");
114
- }
@@ -1,50 +0,0 @@
1
- /*
2
- * Copyright (c) 2016-present Invertase Limited & Contributors
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this library except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- *
16
- */
17
-
18
- import { deepGet, deepSet } from './deeps';
19
-
20
- export class MutatableParams {
21
- _mutatableParams: Record<string, unknown>;
22
- _parentInstance: MutatableParams;
23
-
24
- constructor(parentInstance: MutatableParams) {
25
- if (parentInstance) {
26
- this._mutatableParams = parentInstance._mutatableParams;
27
- this._parentInstance = parentInstance;
28
- } else {
29
- this._mutatableParams = {};
30
- this._parentInstance = this;
31
- }
32
- }
33
-
34
- set(param: string, value: unknown) {
35
- deepSet(this._mutatableParams, param, value);
36
- return this._parentInstance;
37
- }
38
-
39
- get(param: string) {
40
- return deepGet(this._mutatableParams, param, '.');
41
- }
42
-
43
- toJSON() {
44
- return Object.assign({}, this._mutatableParams);
45
- }
46
-
47
- validate() {
48
- // do nothing
49
- }
50
- }
@@ -1,45 +0,0 @@
1
- /*
2
- * Copyright (c) 2016-present Invertase Limited & Contributors
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this library except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- *
16
- */
17
-
18
- export class ReferenceBase {
19
- path: string;
20
-
21
- constructor(_path: string) {
22
- let path = _path;
23
-
24
- if (path) {
25
- path = path.length > 1 && path.endsWith('/') ? path.substring(0, path.length - 1) : path;
26
- if (path.startsWith('/') && path.length > 1) {
27
- path = path.substring(1, path.length);
28
- }
29
- } else {
30
- path = '/';
31
- }
32
-
33
- this.path = path;
34
- }
35
-
36
- /**
37
- * The last part of a Reference's path (after the last '/')
38
- * The key of a root Reference is null.
39
- * @type {String}
40
- * {@link https://firebase.google.com/docs/reference/js/firebase.database.Reference#key}
41
- */
42
- get key() {
43
- return this.path === '/' ? null : this.path.substring(this.path.lastIndexOf('/') + 1);
44
- }
45
- }
@@ -1,88 +0,0 @@
1
- /*
2
- * Copyright (c) 2016-present Invertase Limited & Contributors
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this library except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- *
16
- */
17
-
18
- import { isArray, isObject } from './validate';
19
-
20
- /**
21
- * Deep get a value from an object.
22
- * @website https://github.com/Salakar/deeps
23
- * @param object
24
- * @param path
25
- * @param joiner
26
- * @returns {*}
27
- */
28
- export function deepGet(object: Record<string, unknown>, path: string, joiner = '/') {
29
- if (!isObject(object) && !Array.isArray(object)) {
30
- return undefined;
31
- }
32
- const keys = path.split(joiner);
33
-
34
- let i = 0;
35
- let value;
36
- const len = keys.length;
37
-
38
- while (i < len) {
39
- const key = keys[i++];
40
- if (!object || !Object.hasOwnProperty.call(object, key)) {
41
- return undefined;
42
- }
43
- value = object[key];
44
- }
45
-
46
- return value;
47
- }
48
-
49
- /**
50
- * Deep set a value
51
- * @param object
52
- * @param path
53
- * @param value
54
- * @param initPaths
55
- * @param joiner
56
- */
57
- export function deepSet(
58
- object: Record<string, unknown>,
59
- path: string,
60
- value: unknown,
61
- initPaths = true,
62
- joiner = '.',
63
- ) {
64
- if (!isObject(object)) {
65
- return false;
66
- }
67
- const keys = path.split(joiner);
68
-
69
- let i = 0;
70
- let _object = object;
71
- const len = keys.length - 1;
72
-
73
- while (i < len) {
74
- const key = keys[i++];
75
- if (initPaths && !Object.hasOwnProperty.call(object, key)) {
76
- _object[key] = {};
77
- }
78
- _object = _object[key] as Record<string, unknown>;
79
- }
80
-
81
- if (isObject(_object) || (isArray(_object) && !Number.isNaN(keys[i]))) {
82
- _object[keys[i]] = value;
83
- } else {
84
- return false;
85
- }
86
-
87
- return true;
88
- }
package/src/common/id.ts DELETED
@@ -1,74 +0,0 @@
1
- const PUSH_CHARS = '-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz';
2
-
3
- const AUTO_ID_CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
4
-
5
- // timestamp of last push, used to prevent local collisions if you push twice in one ms.
6
- let lastPushTime = 0;
7
-
8
- // we generate 72-bits of randomness which get turned into 12 characters and appended to the
9
- // timestamp to prevent collisions with other clients. We store the last characters we
10
- // generated because in the event of a collision, we'll use those same characters except
11
- // "incremented" by one.
12
- const lastRandChars: number[] = [];
13
-
14
- /**
15
- * Generate a firebase id - for use with ref().push(val, cb) - e.g. -KXMr7k2tXUFQqiaZRY4'
16
- * @param serverTimeOffset - pass in server time offset from native side
17
- * @returns {string}
18
- */
19
- export function generateDatabaseId(serverTimeOffset = 0) {
20
- const timeStampChars = new Array(8);
21
- let now = new Date().getTime() + serverTimeOffset;
22
- const duplicateTime = now === lastPushTime;
23
-
24
- lastPushTime = now;
25
-
26
- for (let i = 7; i >= 0; i -= 1) {
27
- timeStampChars[i] = PUSH_CHARS.charAt(now % 64);
28
- now = Math.floor(now / 64);
29
- }
30
-
31
- if (now !== 0) {
32
- throw new Error('We should have converted the entire timestamp.');
33
- }
34
-
35
- let id = timeStampChars.join('');
36
-
37
- if (!duplicateTime) {
38
- for (let i = 0; i < 12; i += 1) {
39
- lastRandChars[i] = Math.floor(Math.random() * 64);
40
- }
41
- } else {
42
- // if the timestamp hasn't changed since last push,
43
- // use the same random number, but increment it by 1.
44
- let i;
45
- for (i = 11; i >= 0 && lastRandChars[i] === 63; i -= 1) {
46
- lastRandChars[i] = 0;
47
- }
48
-
49
- lastRandChars[i] += 1;
50
- }
51
-
52
- for (let i = 0; i < 12; i++) {
53
- id += PUSH_CHARS.charAt(lastRandChars[i]);
54
- }
55
-
56
- if (id.length !== 20) {
57
- throw new Error('Length should be 20.');
58
- }
59
-
60
- return id;
61
- }
62
-
63
- /**
64
- * Generate a firestore auto id for use with collection/document .add()
65
- * @return {string}
66
- */
67
- export function generateFirestoreId() {
68
- let autoId = '';
69
-
70
- for (let i = 0; i < 20; i++) {
71
- autoId += AUTO_ID_CHARS.charAt(Math.floor(Math.random() * AUTO_ID_CHARS.length));
72
- }
73
- return autoId;
74
- }
@@ -1,114 +0,0 @@
1
- /*
2
- * Copyright (c) 2016-present Invertase Limited & Contributors
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this library except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- *
16
- */
17
-
18
- /**
19
- * Returns the next parent of the path e.g. /foo/bar/car -> /foo/bar
20
- */
21
- export function pathParent(path: string) {
22
- if (path.length === 0) {
23
- return null;
24
- }
25
-
26
- const index = path.lastIndexOf('/');
27
- if (index <= 0) {
28
- return null;
29
- }
30
-
31
- return path.slice(0, index);
32
- }
33
-
34
- /**
35
- * Joins a parent and a child path
36
- */
37
- export function pathChild(path: string, childPath: string) {
38
- const canonicalChildPath = pathPieces(childPath).join('/');
39
-
40
- if (path.length === 0) {
41
- return canonicalChildPath;
42
- }
43
-
44
- return `${path}/${canonicalChildPath}`;
45
- }
46
-
47
- /**
48
- * Returns the last component of a path, e.g /foo/bar.jpeg -> bar.jpeg
49
- */
50
- export function pathLastComponent(path: string) {
51
- const index = path.lastIndexOf('/', path.length - 2);
52
- if (index === -1) {
53
- return path;
54
- }
55
-
56
- return path.slice(index + 1);
57
- }
58
-
59
- /**
60
- * Returns all none empty pieces of the path
61
- * @param path
62
- * @returns {*}
63
- */
64
- export function pathPieces(path: string) {
65
- return path.split('/').filter($ => $.length > 0);
66
- }
67
-
68
- /**
69
- * Returns whether a given path is empty
70
- * @param path
71
- * @returns {boolean}
72
- */
73
- export function pathIsEmpty(path: string) {
74
- return !pathPieces(path).length;
75
- }
76
-
77
- /**
78
- * Converts a given path to a URL encoded string
79
- * @param path
80
- * @returns {string|string}
81
- */
82
- export function pathToUrlEncodedString(path: string) {
83
- const pieces = pathPieces(path);
84
- let pathString = '';
85
- for (let i = 0; i < pieces.length; i++) {
86
- pathString += `/${encodeURIComponent(String(pieces[i]))}`;
87
- }
88
- return pathString || '/';
89
- }
90
-
91
- // eslint-disable-next-line no-control-regex
92
- export const INVALID_PATH_REGEX = /[[\].#$\u0000-\u001F\u007F]/;
93
-
94
- /**
95
- * Ensures a given path is a valid Firebase path
96
- * @param path
97
- * @returns {boolean}
98
- */
99
- export function isValidPath(path: unknown) {
100
- return typeof path === 'string' && path.length !== 0 && !INVALID_PATH_REGEX.test(path);
101
- }
102
-
103
- /**
104
- * Converts a file path to a standardized string path
105
- * @param path
106
- * @returns {*}
107
- */
108
- export function toFilePath(path: string) {
109
- let _filePath = path.replace('file://', '');
110
- if (_filePath.includes('%')) {
111
- _filePath = decodeURIComponent(_filePath);
112
- }
113
- return _filePath;
114
- }
@@ -1,66 +0,0 @@
1
- /*
2
- * Copyright (c) 2016-present Invertase Limited & Contributors
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this library except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- *
16
- */
17
-
18
- import { isFunction } from './validate';
19
-
20
- /**
21
- *
22
- */
23
- export function promiseDefer() {
24
- const deferred: {
25
- promise: Promise<unknown> | null;
26
- resolve: (value: unknown) => void;
27
- reject: (value: unknown) => void;
28
- } = { promise: null, resolve: () => {}, reject: () => {} };
29
-
30
- deferred.promise = new Promise((resolve, reject) => {
31
- deferred.resolve = resolve;
32
- deferred.reject = reject;
33
- });
34
-
35
- return deferred;
36
- }
37
-
38
- /**
39
- * @param promise
40
- * @param callback
41
- */
42
- export function promiseWithOptionalCallback(
43
- promise: Promise<unknown>,
44
- callback: (a: unknown, b?: unknown) => void,
45
- ) {
46
- if (!isFunction(callback)) {
47
- return promise;
48
- }
49
-
50
- return promise
51
- .then(result => {
52
- if (callback && callback.length === 1) {
53
- callback(null);
54
- } else if (callback) {
55
- callback(null, result);
56
- }
57
-
58
- return result;
59
- })
60
- .catch(error => {
61
- if (callback) {
62
- callback(error);
63
- }
64
- return Promise.reject(error);
65
- });
66
- }
@@ -1,43 +0,0 @@
1
- /*
2
- * Copyright (c) 2016-present Invertase Limited & Contributors
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this library except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- *
16
- */
17
-
18
- import { tryJSONParse, tryJSONStringify } from './index';
19
- import { isObject } from './validate';
20
-
21
- export function serializeType(value: unknown) {
22
- if (isObject(value)) {
23
- return {
24
- type: 'object',
25
- value: serializeObject(value),
26
- };
27
- }
28
-
29
- return {
30
- type: typeof value,
31
- value,
32
- };
33
- }
34
-
35
- export function serializeObject(object: unknown) {
36
- if (!isObject(object)) {
37
- return object;
38
- }
39
-
40
- // json stringify then parse it calls toString on Objects / Classes
41
- // that support it i.e new Date() becomes a ISO string.
42
- return tryJSONParse(tryJSONStringify(object) || '');
43
- }