-
-
Save alex-kinokon/2c1c4c9c56cc21b43e4d2561f66646f5 to your computer and use it in GitHub Desktop.
graphql-i18n-patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/node_modules/graphql/language/characterClasses.js b/node_modules/graphql/language/characterClasses.js | |
index 075f740..4f9c9d7 100644 | |
--- a/node_modules/graphql/language/characterClasses.js | |
+++ b/node_modules/graphql/language/characterClasses.js | |
@@ -48,6 +48,11 @@ function isLetter(code) { | |
(code >= 0x0041 && code <= 0x005a) // a-z | |
); | |
} | |
+ | |
+function isLetter_i18n(code) { | |
+ return /[\p{L}\p{M}\p{Zs}.-]+/gu.test(String.fromCodePoint(code)) && !isWhiteSpace(code); | |
+} | |
+ | |
/** | |
* ``` | |
* NameStart :: | |
@@ -58,7 +63,7 @@ function isLetter(code) { | |
*/ | |
function isNameStart(code) { | |
- return isLetter(code) || code === 0x005f; | |
+ return isLetter_i18n(code) || code === 0x005f; | |
} | |
/** | |
* ``` | |
@@ -71,5 +76,5 @@ function isNameStart(code) { | |
*/ | |
function isNameContinue(code) { | |
- return isLetter(code) || isDigit(code) || code === 0x005f; | |
+ return isLetter_i18n(code) || isDigit(code) || code === 0x005f; | |
} | |
diff --git a/node_modules/graphql/language/characterClasses.mjs b/node_modules/graphql/language/characterClasses.mjs | |
index c75777a..6c9e8bf 100644 | |
--- a/node_modules/graphql/language/characterClasses.mjs | |
+++ b/node_modules/graphql/language/characterClasses.mjs | |
@@ -37,6 +37,11 @@ export function isLetter(code) { | |
(code >= 0x0041 && code <= 0x005a) // a-z | |
); | |
} | |
+ | |
+function isLetter_i18n(code) { | |
+ return /[\p{L}\p{M}\p{Zs}.-]+/gu.test(String.fromCodePoint(code)) && !isWhiteSpace(code); | |
+} | |
+ | |
/** | |
* ``` | |
* NameStart :: | |
@@ -47,7 +52,7 @@ export function isLetter(code) { | |
*/ | |
export function isNameStart(code) { | |
- return isLetter(code) || code === 0x005f; | |
+ return isLetter_i18n(code) || code === 0x005f; | |
} | |
/** | |
* ``` | |
@@ -60,5 +65,5 @@ export function isNameStart(code) { | |
*/ | |
export function isNameContinue(code) { | |
- return isLetter(code) || isDigit(code) || code === 0x005f; | |
+ return isLetter_i18n(code) || isDigit(code) || code === 0x005f; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment