UNPKG

384 BJavaScriptView Raw
1/**
2 * Return array of strings split from the output of `git <something> -z`.
3 * With `-z`, git prints `fileA\u0000fileB\u0000fileC\u0000` so we need to
4 * remove the last occurrence of `\u0000` before splitting
5 */
6export const parseGitZOutput = (input) =>
7 input
8 ? input
9 .replace(/\u0000$/, '') // eslint-disable-line no-control-regex
10 .split('\u0000')
11 : []