UNPKG

@graphiql/react

Version:

[Changelog](https://github.com/graphql/graphiql/blob/main/packages/graphiql-react/CHANGELOG.md) | [API Docs](https://graphiql-test.netlify.app/typedoc/modules/graphiql_react.html) | [NPM](https://www.npmjs.com/package/@graphiql/react)

14 lines (10 loc) 442 B
'use no memo'; // Unicode whitespace characters that break the interface. export const invalidCharacters = Array.from({ length: 11 }, (_, i) => { // \u2000 -> \u200a return String.fromCharCode(0x2000 + i); }).concat(['\u2028', '\u2029', '\u202f', '\u00a0']); const sanitizeRegex = new RegExp('[' + invalidCharacters.join('') + ']', 'g'); export function normalizeWhitespace(line: string) { return line.replace(sanitizeRegex, ' '); }