@platformos/pos-cli
Version:
Manage your platformOS application
27 lines (24 loc) • 803 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.normalizeWhitespace = normalizeWhitespace;
exports.invalidCharacters = void 0;
/**
* Copyright (c) 2019 GraphQL Contributors.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
// Unicode whitespace characters that break the interface.
const invalidCharacters = Array.from({
length: 11
}, (x, i) => {
// \u2000 -> \u200a
return String.fromCharCode(0x2000 + i);
}).concat(['\u2028', '\u2029', '\u202f', '\u00a0']);
exports.invalidCharacters = invalidCharacters;
const sanitizeRegex = new RegExp('[' + invalidCharacters.join('') + ']', 'g');
function normalizeWhitespace(line) {
return line.replace(sanitizeRegex, ' ');
}