Skip to content

Commit

Permalink
Merge pull request #557 from inveniosoftware-contrib/revert-555-fix_m…
Browse files Browse the repository at this point in the history
…erge_error

Revert "fix undefined property error"
  • Loading branch information
karolina-siemieniuk-morawska authored Jan 25, 2024
2 parents 92b1656 + 9796b6c commit 2c9b483
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions src/shared/services/compare-keys-by-schema.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,11 @@ export class CompareKeysBySchemaService {
*/
compare(key1: string, key2: string, schema: JSONSchema): number {
// Sort by priority, larger is the first.
const priority1 =
(schema &&
schema.properties &&
schema.properties[key1] &&
schema.properties[key1].priority) ||
0;
const priority2 =
(schema &&
schema.properties &&
schema.properties[key2] &&
schema.properties[key2].priority) ||
0;
const priorty1 = schema.properties[key1].priority || 0;
const priority2 = schema.properties[key2].priority || 0;

if (priority1 > priority2) { return -1; }
if (priority1 < priority2) { return 1; }
if (priorty1 > priority2) { return -1; }
if (priorty1 < priority2) { return 1; }

// Sort alphabetically.
if (key1 < key2) { return -1; }
Expand Down

0 comments on commit 2c9b483

Please sign in to comment.