Numeric compare for HubSpot ids (decimal strings, treated numerically by GT/LT).
(a: string, b: string)
| 961 | |
| 962 | /** Numeric compare for HubSpot ids (decimal strings, treated numerically by GT/LT). */ |
| 963 | function compareObjectIds(a: string, b: string): number { |
| 964 | if (!a) return b ? -1 : 0 |
| 965 | if (!b) return 1 |
| 966 | const an = Number(a) |
| 967 | const bn = Number(b) |
| 968 | if (Number.isFinite(an) && Number.isFinite(bn)) { |
| 969 | if (an === bn) return 0 |
| 970 | return an > bn ? 1 : -1 |
| 971 | } |
| 972 | if (a === b) return 0 |
| 973 | return a > b ? 1 : -1 |
| 974 | } |
no outgoing calls
no test coverage detected