mirror of
https://github.com/hanzoai/lint-staged.git
synced 2026-10-30 19:37:36 +00:00
12 lines
384 B
JavaScript
12 lines
384 B
JavaScript
/**
|
|
* Return array of strings split from the output of `git <something> -z`.
|
|
* With `-z`, git prints `fileA\u0000fileB\u0000fileC\u0000` so we need to
|
|
* remove the last occurrence of `\u0000` before splitting
|
|
*/
|
|
export const parseGitZOutput = (input) =>
|
|
input
|
|
? input
|
|
.replace(/\u0000$/, '') // oxlint-disable-line no-control-regex
|
|
.split('\u0000')
|
|
: []
|