Built motion from commit 6a09e18b.|2.6.11
[motion2.git] / legacy-libs / node-pre-gyp / node_modules / tar / lib / winchars.js
1 'use strict'
2
3 // When writing files on Windows, translate the characters to their
4 // 0xf000 higher-encoded versions.
5
6 const raw = [
7   '|',
8   '<',
9   '>',
10   '?',
11   ':'
12 ]
13
14 const win = raw.map(char =>
15   String.fromCharCode(0xf000 + char.charCodeAt(0)))
16
17 const toWin = new Map(raw.map((char, i) => [char, win[i]]))
18 const toRaw = new Map(win.map((char, i) => [char, raw[i]]))
19
20 module.exports = {
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)
23 }