diff options
| author | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-07-28 11:44:16 +0000 |
|---|---|---|
| committer | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-07-28 11:44:16 +0000 |
| commit | c228a89c2834ee63b209bad608837c39643f350e (patch) | |
| tree | 39c9a121b556af872072dd80750dedf2d2d62335 /lib/utils.ts | |
| parent | 50ae0b8f02c034e60d4cbb504620dfa1575a836f (diff) | |
(대표님) 의존성 docx 추가, basicContract API, gtc(계약일반조건), 벤더평가 esg 평가데이터 내보내기 개선, S-EDP 피드백 대응(CLS_ID, ITEM NO 등)
Diffstat (limited to 'lib/utils.ts')
| -rw-r--r-- | lib/utils.ts | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/utils.ts b/lib/utils.ts index cb15e830..4d987902 100644 --- a/lib/utils.ts +++ b/lib/utils.ts @@ -275,3 +275,17 @@ export function formatHtml(html: string): string { return result.join('\n'); } + + +export function compareItemNumber(a?: string, b?: string) { + const as = (a ?? "").split(".").map((v) => Number(v)); + const bs = (b ?? "").split(".").map((v) => Number(v)); + + const len = Math.max(as.length, bs.length); + for (let i = 0; i < len; i++) { + const av = Number.isFinite(as[i]) ? as[i] : Number.NEGATIVE_INFINITY; // 부모가 먼저 + const bv = Number.isFinite(bs[i]) ? bs[i] : Number.NEGATIVE_INFINITY; + if (av !== bv) return av - bv; + } + return as.length - bs.length; +}
\ No newline at end of file |
