Files
agency/.pnpm-store/v11/files/01/6cdd665fe8a7191d913b4bd9238bd6dc54354434f53900c543dea815135e67d0e716010e8faa315cc0911957c788a39163bbf62acc51bcbbcf48546d6d6abb
hanzo-agent 5af6960b87 run project
Run: sess_f37640604ae254cb4d11dc6217f7b721
2026-09-30 00:04:56 +00:00

24 lines
410 B
Plaintext

const numeric = /^[0-9]+$/
const compareIdentifiers = (a, b) => {
const anum = numeric.test(a)
const bnum = numeric.test(b)
if (anum && bnum) {
a = +a
b = +b
}
return a === b ? 0
: (anum && !bnum) ? -1
: (bnum && !anum) ? 1
: a < b ? -1
: 1
}
const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a)
module.exports = {
compareIdentifiers,
rcompareIdentifiers,
}