es-toolkit 1.47.0-dev.1828 → 1.47.0-dev.1830
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -5
- package/dist/_internal/compareValues.js +16 -3
- package/dist/_internal/compareValues.mjs +16 -3
- package/package.json +6 -5
package/LICENSE
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2024 Viva Republica, Inc
|
|
4
|
-
|
|
5
|
-
Copyright OpenJS Foundation and other contributors
|
|
6
|
-
|
|
7
|
-
Parts of the test suite and compatibility layer in `es-toolkit/compat` are derived from Lodash (https://github.com/lodash/lodash) by the OpenJS Foundation (https://openjsf.org/) and Underscore.js by Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors (http://underscorejs.org/)
|
|
3
|
+
Copyright (c) 2024 Viva Republica, Inc.
|
|
8
4
|
|
|
9
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
10
6
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -1,8 +1,21 @@
|
|
|
1
1
|
//#region src/_internal/compareValues.ts
|
|
2
|
-
function
|
|
3
|
-
if (
|
|
4
|
-
if (
|
|
2
|
+
function nullishRank(value) {
|
|
3
|
+
if (value === null) return 1;
|
|
4
|
+
if (value === void 0) return 2;
|
|
5
|
+
return 0;
|
|
6
|
+
}
|
|
7
|
+
function compareAscending(a, b) {
|
|
8
|
+
const aRank = nullishRank(a);
|
|
9
|
+
const bRank = nullishRank(b);
|
|
10
|
+
if (aRank < bRank) return -1;
|
|
11
|
+
if (aRank > bRank) return 1;
|
|
12
|
+
if (aRank !== 0) return 0;
|
|
13
|
+
if (a < b) return -1;
|
|
14
|
+
if (a > b) return 1;
|
|
5
15
|
return 0;
|
|
6
16
|
}
|
|
17
|
+
function compareValues(a, b, order) {
|
|
18
|
+
return order === "asc" ? compareAscending(a, b) : compareAscending(b, a);
|
|
19
|
+
}
|
|
7
20
|
//#endregion
|
|
8
21
|
exports.compareValues = compareValues;
|
|
@@ -1,8 +1,21 @@
|
|
|
1
1
|
//#region src/_internal/compareValues.ts
|
|
2
|
-
function
|
|
3
|
-
if (
|
|
4
|
-
if (
|
|
2
|
+
function nullishRank(value) {
|
|
3
|
+
if (value === null) return 1;
|
|
4
|
+
if (value === void 0) return 2;
|
|
5
|
+
return 0;
|
|
6
|
+
}
|
|
7
|
+
function compareAscending(a, b) {
|
|
8
|
+
const aRank = nullishRank(a);
|
|
9
|
+
const bRank = nullishRank(b);
|
|
10
|
+
if (aRank < bRank) return -1;
|
|
11
|
+
if (aRank > bRank) return 1;
|
|
12
|
+
if (aRank !== 0) return 0;
|
|
13
|
+
if (a < b) return -1;
|
|
14
|
+
if (a > b) return 1;
|
|
5
15
|
return 0;
|
|
6
16
|
}
|
|
17
|
+
function compareValues(a, b, order) {
|
|
18
|
+
return order === "asc" ? compareAscending(a, b) : compareAscending(b, a);
|
|
19
|
+
}
|
|
7
20
|
//#endregion
|
|
8
21
|
export { compareValues };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "es-toolkit",
|
|
3
|
-
"version": "1.47.0-dev.
|
|
3
|
+
"version": "1.47.0-dev.1830+09f41018",
|
|
4
4
|
"description": "A state-of-the-art, high-performance JavaScript utility library with a small bundle size and strong type annotations.",
|
|
5
5
|
"homepage": "https://es-toolkit.dev",
|
|
6
6
|
"bugs": "https://github.com/toss/es-toolkit/issues",
|
|
@@ -200,24 +200,25 @@
|
|
|
200
200
|
"@changesets/cli": "^2.27.1",
|
|
201
201
|
"@eslint/js": "^9.39.2",
|
|
202
202
|
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
|
|
203
|
-
"@types/broken-link-checker": "
|
|
203
|
+
"@types/broken-link-checker": "0.7.3",
|
|
204
204
|
"@types/jscodeshift": "^0.12.0",
|
|
205
|
-
"@types/lodash": "
|
|
205
|
+
"@types/lodash": "4.17.20",
|
|
206
206
|
"@types/node": "^24.10.9",
|
|
207
207
|
"@types/tar": "^6.1.13",
|
|
208
208
|
"@typescript-eslint/parser": "^8.26.1",
|
|
209
209
|
"@vitest/coverage-istanbul": "^4.0.17",
|
|
210
210
|
"@vitest/eslint-plugin": "^1.6.6",
|
|
211
211
|
"@vue/compiler-sfc": "^3.5.10",
|
|
212
|
-
"broken-link-checker": "
|
|
212
|
+
"broken-link-checker": "0.7.8",
|
|
213
213
|
"eslint": "^9.39.2",
|
|
214
214
|
"eslint-config-prettier": "^9.1.0",
|
|
215
215
|
"eslint-plugin-no-for-of-array": "^0.0.1",
|
|
216
216
|
"eslint-plugin-prettier": "^5.2.1",
|
|
217
217
|
"eslint-plugin-vue": "^9.28.0",
|
|
218
218
|
"execa": "^9.3.0",
|
|
219
|
+
"fast-check": "4.8.0",
|
|
219
220
|
"globals": "^15.9.0",
|
|
220
|
-
"happy-dom": "
|
|
221
|
+
"happy-dom": "20.9.0",
|
|
221
222
|
"jscodeshift": "^17.0.0",
|
|
222
223
|
"packlint": "^0.2.4",
|
|
223
224
|
"prettier": "^3.2.5",
|