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
package/index.js
CHANGED
|
@@ -7,18 +7,32 @@
|
|
|
7
7
|
*
|
|
8
8
|
* @format
|
|
9
9
|
*/
|
|
10
|
+
// flowlint ambiguous-object-type:error
|
|
10
11
|
'use strict';
|
|
11
12
|
|
|
12
13
|
var internTable = new Map();
|
|
13
14
|
var nextIndex = 1;
|
|
14
|
-
var digits =
|
|
15
|
+
var digits = initDigitTable(); // Character used as the prefix for interned strings. The specific character is
|
|
15
16
|
// chosen to reduce the likelihood that non-interned input strings need to be
|
|
16
17
|
// escaped (choosing eg a-Z would increase the likelihood we need to escape)
|
|
17
18
|
|
|
18
19
|
var INTERN_PREFIX = '\t'; // Character used as the prefix of escaped strings. As above, this is also
|
|
19
20
|
// chosen to be unlikely in normal input strings.
|
|
20
21
|
|
|
21
|
-
var ESCAPE_PREFIX = '\v';
|
|
22
|
+
var ESCAPE_PREFIX = '\v';
|
|
23
|
+
|
|
24
|
+
function initDigitTable() {
|
|
25
|
+
// disable lint because digits isn't defined when this function is called
|
|
26
|
+
// eslint-disable-next-line no-shadow
|
|
27
|
+
var digits = new Set();
|
|
28
|
+
|
|
29
|
+
for (var i = 0; i < 10; ++i) {
|
|
30
|
+
digits.add(i.toString());
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return digits;
|
|
34
|
+
} // Escape a string so that it cannot conflict with an interned string
|
|
35
|
+
|
|
22
36
|
|
|
23
37
|
function escape(str) {
|
|
24
38
|
if ( // "\t<digit>..." -> "\v\t<digit>..."
|