Skip to content

Commit 9806bac

Browse files
committed
feat(types): add TextshiftResult, ObjectSorter, and SortComparator types
- Add ObjectSorter type for object key-value reordering - Add SortComparator type for string comparison functions - Add TextshiftResult interface with data and error fields
1 parent 4d75e16 commit 9806bac

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

src/types.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/**
2+
* Text operation result container.
3+
* @description Holds transformed data or error message.
4+
*/
5+
export interface TextshiftResult {
6+
/** Transformed output string */
7+
data?: string
8+
/** Error message on failure */
9+
error?: string
10+
}
11+
12+
/**
13+
* Object key-value sorting function.
14+
* @description Reorders object entries by specified criteria.
15+
* @param obj - Source object to sort
16+
* @returns New object with sorted entries
17+
*/
18+
export type ObjectSorter = (obj: Record<string, unknown>) => Record<string, unknown>
19+
20+
/**
21+
* String comparison function for sorting.
22+
* @description Compares two strings for sort ordering.
23+
* @param a - First string to compare
24+
* @param b - Second string to compare
25+
* @returns Negative, zero, or positive number
26+
*/
27+
export type SortComparator = (a: string, b: string) => number

0 commit comments

Comments
 (0)