3 // When writing files on Windows, translate the characters to their
4 // 0xf000 higher-encoded versions.
14 const win = raw.map(char =>
15 String.fromCharCode(0xf000 + char.charCodeAt(0)))
17 const toWin = new Map(raw.map((char, i) => [char, win[i]]))
18 const toRaw = new Map(win.map((char, i) => [char, raw[i]]))
21 encode: s => raw.reduce((s, c) => s.split(c).join(toWin.get(c)), s),
22 decode: s => win.reduce((s, c) => s.split(c).join(toRaw.get(c)), s)