Add default replacment to sanitizeIRI.

This commit is contained in:
Caleb 2017-10-03 14:11:20 -06:00
parent be28f895bc
commit f40f58b7dd

View File

@ -23,7 +23,7 @@ export function getNewEntryUrl(collectionName, direct) {
*/
const uriChars = /[\w\-.~]/i;
const ucsChars = /[\xA0-\u{D7FF}\u{F900}-\u{FDCF}\u{FDF0}-\u{FFEF}\u{10000}-\u{1FFFD}\u{20000}-\u{2FFFD}\u{30000}-\u{3FFFD}\u{40000}-\u{4FFFD}\u{50000}-\u{5FFFD}\u{60000}-\u{6FFFD}\u{70000}-\u{7FFFD}\u{80000}-\u{8FFFD}\u{90000}-\u{9FFFD}\u{A0000}-\u{AFFFD}\u{B0000}-\u{BFFFD}\u{C0000}-\u{CFFFD}\u{D0000}-\u{DFFFD}\u{E1000}-\u{EFFFD}]/u;
export function sanitizeIRI(str, { replacement }) {
export function sanitizeIRI(str, { replacement = "" } = {}) {
let result = "";
// We cannot use a `map` function here because `string.split()`
// splits things like emojis into UTF-16 surrogate pairs,