import { FileCompare } from "../services/versions" ; import Diff from "./diff" ; const fileSorter = function ( a , b ) { const aPath = a . filename ; const bPath = b . filename ; if ( aPath > bPath ) { return 1 ; } if ( aPath < bPath ) { return - 1 ; } return 0 ; } ; export default class Patch { files : FileCompare [ ] ; constructor ( files ) { this . files = files . sort ( fileSorter ) ; } get diffs ( ) { return this . files . map ( ( fileCompare ) => new Diff ( fileCompare ) ) ; } }