From f46c14ab27a89d9c38a2b95ae5ea5ac0eb0c9c42 Mon Sep 17 00:00:00 2001 From: Kevin Deng Date: Mon, 27 Jul 2026 23:24:08 +0900 Subject: [PATCH] fix: replace `toSorted` with `sort` for compatibility closes #3 --- eslint.config.js | 6 +++++- src/comparison.ts | 4 ++-- tsconfig.json | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/eslint.config.js b/eslint.config.js index b3d5acd..e9f4b01 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -1,3 +1,7 @@ import { sxzz } from '@sxzz/eslint-config' -export default sxzz() +export default sxzz().append({ + rules: { + 'unicorn/no-array-sort': 'off', + }, +}) diff --git a/src/comparison.ts b/src/comparison.ts index 9404e52..78a6e28 100644 --- a/src/comparison.ts +++ b/src/comparison.ts @@ -133,12 +133,12 @@ export function sort( versions: readonly T[], options: VersionOptions = {}, ): T[] { - return versions.toSorted((left, right) => compareBuild(left, right, options)) + return [...versions].sort((left, right) => compareBuild(left, right, options)) } export function sortReversed( versions: readonly T[], options: VersionOptions = {}, ): T[] { - return versions.toSorted((left, right) => compareBuild(right, left, options)) + return [...versions].sort((left, right) => compareBuild(right, left, options)) } diff --git a/tsconfig.json b/tsconfig.json index bd35590..55abeb6 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { "target": "esnext", - "lib": ["es2024"], + "lib": ["es2022"], "moduleDetection": "force", "module": "nodenext", "moduleResolution": "nodenext", -- 2.51.2