@ahoo-wang/fetcher 2.8.2 → 2.8.3

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.
@@ -1,22 +1,40 @@
1
1
  /**
2
- * OrderedCapable Interface
2
+ * Interface for objects that can be ordered
3
3
  *
4
- * Interface that provides ordering capability for types that implement it.
5
- * Implementing types must provide an order property to determine execution order.
6
- * Lower numerical values have higher priority, and elements with the same value
7
- * maintain their relative order.
4
+ * This interface allows objects to specify their execution or display order.
5
+ * Objects implementing this interface can be sorted using the `toSorted` function.
6
+ * Lower order values indicate higher priority (executed/displayed first).
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * const interceptor: OrderedCapable = { order: 10 };
11
+ * const highPriority: OrderedCapable = { order: -5 };
12
+ * ```
8
13
  */
9
14
  export interface OrderedCapable {
10
15
  /**
11
- * Order value
16
+ * Optional order value for sorting
17
+ *
18
+ * - Lower values have higher priority (sorted first)
19
+ * - Supports negative, zero, and positive numbers
20
+ * - Defaults to 0 if undefined
21
+ * - Equal values maintain original relative order (stable sort)
12
22
  *
13
- * Lower numerical values have higher priority. Negative numbers, zero, and
14
- * positive numbers are all supported.
15
- * When multiple elements have the same order value, their relative order
16
- * will remain unchanged (stable sort).
23
+ * @default 0
17
24
  */
18
- order: number;
25
+ order?: number;
19
26
  }
27
+ /**
28
+ * Comparator function for sorting OrderedCapable elements
29
+ *
30
+ * Compares two elements based on their order property. Elements with lower order values
31
+ * are sorted first. If order is undefined, defaults to DEFAULT_ORDER (0).
32
+ *
33
+ * @param a - First element to compare
34
+ * @param b - Second element to compare
35
+ * @returns Negative if a < b, positive if a > b, zero if equal
36
+ */
37
+ export declare function sortOrder<T extends OrderedCapable>(a: T, b: T): number;
20
38
  /**
21
39
  * Sorts an array of elements that implement the OrderedCapable interface
22
40
  *
@@ -1 +1 @@
1
- {"version":3,"file":"orderedCapable.d.ts","sourceRoot":"","sources":["../src/orderedCapable.ts"],"names":[],"mappings":"AAaA;;;;;;;GAOG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;;;;OAOG;IACH,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,cAAc,EAC/C,KAAK,EAAE,CAAC,EAAE,EACV,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,OAAO,GAC5B,CAAC,EAAE,CAKL"}
1
+ {"version":3,"file":"orderedCapable.d.ts","sourceRoot":"","sources":["../src/orderedCapable.ts"],"names":[],"mappings":"AAeA;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;;;;;;OASG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;GASG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,cAAc,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,MAAM,CAEtE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,cAAc,EAC/C,KAAK,EAAE,CAAC,EAAE,EACV,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,OAAO,GAC5B,CAAC,EAAE,CAKL"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ahoo-wang/fetcher",
3
- "version": "2.8.2",
3
+ "version": "2.8.3",
4
4
  "description": "Fetcher is not just another HTTP client—it's a complete ecosystem designed for modern web development with native LLM\nstreaming API support. Built on the native Fetch API, Fetcher provides an Axios-like experience with powerful features\nwhile maintaining an incredibly small footprint.",
5
5
  "keywords": [
6
6
  "fetch",