import { v4 as uuidv4 } from 'uuid' ; import { EditId } from '../Identifiers' ; import { Edit , TraitLocation } from './PersistedTypes' ; /**
 * Functions for constructing and comparing Edits.
 */ /**
 * Returns true if the provided Edits have equivalent properties.
 */ export function compareEdits ( editIdA , editIdB ) { return editIdA === editIdB ; } /**
 * Check if two TraitLocations are equal.
 */ export function compareTraits ( traitA , traitB ) { if ( traitA . label !== traitB . label || traitA . parent !== traitB . parent ) { return false ; } return true ; } /**
 * Generates a new edit object from the supplied changes.
 */ export function newEdit < TEdit > ( changes ) { return { id : newEditId ( ) , changes } ; } /**
 * Generates a new edit object from the supplied changes.
 */ export function newEditId ( ) { return uuidv4 ( ) as EditId ; }