@pierre/diffs
Version:
19 lines (18 loc) • 613 B
JavaScript
import { parsePatchFiles } from "./parsePatchFiles.js";
//#region src/utils/getSingularPatch.ts
function getSingularPatch(patch) {
const parsedPatches = parsePatchFiles(patch);
if (parsedPatches.length !== 1) {
console.error(parsedPatches);
throw new Error("PatchDiff: Provided patch must include only 1 patch, with 1 diff");
}
const { files } = parsedPatches[0];
if (files.length !== 1) {
console.error(files);
throw new Error("FileDiff: Provided patch must contain exactly 1 file diff");
}
return files[0];
}
//#endregion
export { getSingularPatch };
//# sourceMappingURL=getSingularPatch.js.map