relay-runtime 0.0.0-main-98b2cef3 → 0.0.0-main-cc6e7ec6
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/index.js +1 -1
- package/lib/util/StringInterner.js +16 -2
- package/package.json +1 -1
- package/relay-runtime.js +2 -2
- package/relay-runtime.min.js +2 -2
- package/util/StringInterner.js.flow +13 -1
|
@@ -8,11 +8,13 @@
|
|
|
8
8
|
* @format
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
+
// flowlint ambiguous-object-type:error
|
|
12
|
+
|
|
11
13
|
'use strict';
|
|
12
14
|
|
|
13
15
|
const internTable = new Map();
|
|
14
16
|
let nextIndex = 1;
|
|
15
|
-
const digits =
|
|
17
|
+
const digits = initDigitTable();
|
|
16
18
|
|
|
17
19
|
// Character used as the prefix for interned strings. The specific character is
|
|
18
20
|
// chosen to reduce the likelihood that non-interned input strings need to be
|
|
@@ -22,6 +24,16 @@ const INTERN_PREFIX = '\t';
|
|
|
22
24
|
// chosen to be unlikely in normal input strings.
|
|
23
25
|
const ESCAPE_PREFIX = '\v';
|
|
24
26
|
|
|
27
|
+
function initDigitTable() {
|
|
28
|
+
// disable lint because digits isn't defined when this function is called
|
|
29
|
+
// eslint-disable-next-line no-shadow
|
|
30
|
+
const digits = new Set();
|
|
31
|
+
for (let i = 0; i < 10; ++i) {
|
|
32
|
+
digits.add(i.toString());
|
|
33
|
+
}
|
|
34
|
+
return digits;
|
|
35
|
+
}
|
|
36
|
+
|
|
25
37
|
// Escape a string so that it cannot conflict with an interned string
|
|
26
38
|
function escape(str: string): string {
|
|
27
39
|
if (
|