@thi.ng/compare 2.2.25 → 2.2.26

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/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Change Log
2
2
 
3
- - **Last updated**: 2024-03-09T09:18:17Z
3
+ - **Last updated**: 2024-03-13T14:04:31Z
4
4
  - **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
5
5
 
6
6
  All notable changes to this project will be documented in this file.
package/keys.d.ts CHANGED
@@ -6,15 +6,15 @@ import type { Comparator, Fn, Keys, Val1 } from "@thi.ng/api";
6
6
  * @param key -
7
7
  * @param cmp -
8
8
  */
9
- export declare function compareByKey<T, A extends Keys<T>>(a: A, cmp?: Comparator<Val1<T, A>>): Comparator<T>;
9
+ export declare function compareByKey<T, K extends Keys<T>>(key: K, cmp?: Comparator<Val1<T, K>>): Comparator<T>;
10
10
  export declare function compareByKey<T, A>(a: Fn<T, A>, cmp?: Comparator<A>): Comparator<T>;
11
11
  /**
12
12
  * HOF comparator. Returns new comparator to sort objects by given keys
13
13
  * `a` (major), `b` (minor) and with optional comparators (default for
14
14
  * each: {@link compare}).
15
15
  *
16
- * @param a -
17
- * @param b -
16
+ * @param major -
17
+ * @param minor -
18
18
  * @param cmpA -
19
19
  * @param cmpB -
20
20
  */
@@ -23,14 +23,14 @@ export declare function compareByKeys2<T, A, B>(major: Fn<T, A>, minor: Fn<T, B>
23
23
  /**
24
24
  * Same as {@link compareByKeys2}, but for 3 sort keys / comparators.
25
25
  *
26
- * @param a -
27
- * @param b -
28
- * @param c -
26
+ * @param major -
27
+ * @param minor -
28
+ * @param patch -
29
29
  * @param cmpA -
30
30
  * @param cmpB -
31
31
  * @param cmpC -
32
32
  */
33
- export declare function compareByKeys3<T, A extends Keys<T>, B extends Keys<T>, C extends Keys<T>>(major: A, minor: B, patch: B, cmpA?: Comparator<Val1<T, A>>, cmpB?: Comparator<Val1<T, B>>, cmpC?: Comparator<Val1<T, C>>): Comparator<T>;
33
+ export declare function compareByKeys3<T, A extends Keys<T>, B extends Keys<T>, C extends Keys<T>>(major: A, minor: B, patch: C, cmpA?: Comparator<Val1<T, A>>, cmpB?: Comparator<Val1<T, B>>, cmpC?: Comparator<Val1<T, C>>): Comparator<T>;
34
34
  export declare function compareByKeys3<T, A, B, C>(major: Fn<T, A>, minor: Fn<T, B>, patch: Fn<T, C>, cmpA?: Comparator<A>, cmpB?: Comparator<B>, cmpC?: Comparator<C>): Comparator<T>;
35
35
  /**
36
36
  * Same as {@link compareByKeys2}, but for 4 sort keys / comparators.
package/keys.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { compare } from "./compare.js";
2
2
  const getKey = (k) => typeof k === "function" ? k : (x) => x[k];
3
- function compareByKey(a, cmp = compare) {
4
- const k = getKey(a);
5
- return (x, y) => cmp(k(x), k(y));
3
+ function compareByKey(key, cmp = compare) {
4
+ const kfn = getKey(key);
5
+ return (x, y) => cmp(kfn(x), kfn(y));
6
6
  }
7
7
  function compareByKeys2(a, b, cmpA = compare, cmpB = compare) {
8
8
  const ka = getKey(a);
package/ops.d.ts CHANGED
@@ -11,7 +11,7 @@ export declare const OPERATORS: Record<Operator, Predicate2<string> | Predicate2
11
11
  * See {@link numericOp} for related functionality.
12
12
  *
13
13
  * @example
14
- * ```ts
14
+ * ```ts tangle:../export/string-op.ts
15
15
  * import { stringOp } from "@thi.ng/compare";
16
16
  *
17
17
  * const equalsABC = stringOp("=", "abc");
@@ -44,7 +44,7 @@ export declare const stringOp: (op: Operator | Predicate2<string>, x: string) =>
44
44
  * false.
45
45
  *
46
46
  * @example
47
- * ```ts
47
+ * ```ts tangle:../export/numeric-op.ts
48
48
  * import { numericOp } from "@thi.ng/compare";
49
49
  *
50
50
  * const lessThan42 = numericOp("<", 42);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/compare",
3
- "version": "2.2.25",
3
+ "version": "2.2.26",
4
4
  "description": "Comparators with support for types implementing the @thi.ng/api/ICompare interface",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -36,14 +36,14 @@
36
36
  "tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
37
37
  },
38
38
  "dependencies": {
39
- "@thi.ng/api": "^8.9.29"
39
+ "@thi.ng/api": "^8.9.30"
40
40
  },
41
41
  "devDependencies": {
42
- "@microsoft/api-extractor": "^7.40.1",
43
- "esbuild": "^0.20.0",
42
+ "@microsoft/api-extractor": "^7.42.3",
43
+ "esbuild": "^0.20.1",
44
44
  "rimraf": "^5.0.5",
45
- "typedoc": "^0.25.7",
46
- "typescript": "^5.3.3"
45
+ "typedoc": "^0.25.12",
46
+ "typescript": "^5.4.2"
47
47
  },
48
48
  "keywords": [
49
49
  "comparator",
@@ -80,5 +80,5 @@
80
80
  "default": "./reverse.js"
81
81
  }
82
82
  },
83
- "gitHead": "69100942474942f7446ac645d59d91e7dfc352f9\n"
83
+ "gitHead": "7f3fcbd6c0462b0ce45afa141fe163d1f297fd51\n"
84
84
  }