( a: Pick<ToolPolicyRow, "position" | "id">, b: Pick<ToolPolicyRow, "position" | "id">, )
| 128 | // --------------------------------------------------------------------------- |
| 129 | |
| 130 | export const comparePolicyRow = ( |
| 131 | a: Pick<ToolPolicyRow, "position" | "id">, |
| 132 | b: Pick<ToolPolicyRow, "position" | "id">, |
| 133 | ): number => { |
| 134 | const pa = a.position; |
| 135 | const pb = b.position; |
| 136 | if (pa < pb) return -1; |
| 137 | if (pa > pb) return 1; |
| 138 | const ia = a.id; |
| 139 | const ib = b.id; |
| 140 | return ia < ib ? -1 : ia > ib ? 1 : 0; |
| 141 | }; |
| 142 | |
| 143 | // Specificity score for ordering. Higher = more specific = should sit at a |
| 144 | // lower position-key (higher precedence). New rules are auto-placed below |
no outgoing calls
no test coverage detected