mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-14 09:25:43 +01:00
use reflow to migrate from flow to typescript
This commit is contained in:
17
scm-ui/ui-components/src/repos/diffs.ts
Normal file
17
scm-ui/ui-components/src/repos/diffs.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { BaseContext, File, Hunk } from './DiffTypes';
|
||||
|
||||
export function getPath(file: File) {
|
||||
if (file.type === 'delete') {
|
||||
return file.oldPath;
|
||||
}
|
||||
return file.newPath;
|
||||
}
|
||||
|
||||
export function createHunkIdentifier(file: File, hunk: Hunk) {
|
||||
const path = getPath(file);
|
||||
return `${file.type}_${path}_${hunk.content}`;
|
||||
}
|
||||
|
||||
export function createHunkIdentifierFromContext(ctx: BaseContext) {
|
||||
return createHunkIdentifier(ctx.file, ctx.hunk);
|
||||
}
|
||||
Reference in New Issue
Block a user