mirror of
https://github.com/maelgangloff/domain-watchdog.git
synced 2025-12-17 17:55:42 +00:00
15 lines
479 B
TypeScript
15 lines
479 B
TypeScript
import type {Domain} from '../api'
|
|
|
|
export const sortDomainEntities = (domain: Domain) => domain.entities
|
|
.filter(e => e.deletedAt === undefined)
|
|
.sort((e1, e2) => {
|
|
const p = (r: string[]) => r.includes('registrant')
|
|
? 5
|
|
: r.includes('administrative')
|
|
? 4
|
|
: r.includes('billing')
|
|
? 3
|
|
: r.includes('registrar') ? 2 : 1
|
|
return p(e2.roles) - p(e1.roles)
|
|
})
|