@umituz/react-native-ai-generation-content 1.26.22 → 1.26.23
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/package.json +1 -1
- package/src/index.ts +2 -0
- package/src/utils/arrayUtils.ts +22 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-ai-generation-content",
|
|
3
|
-
"version": "1.26.
|
|
3
|
+
"version": "1.26.23",
|
|
4
4
|
"description": "Provider-agnostic AI generation orchestration for React Native with result preview components",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"types": "src/index.ts",
|
package/src/index.ts
CHANGED
|
@@ -59,6 +59,8 @@ export {
|
|
|
59
59
|
saveMediaToGallery, shareMedia, createSaveHandler, createShareHandler, createMediaHandlers,
|
|
60
60
|
} from "./infrastructure/utils";
|
|
61
61
|
|
|
62
|
+
export { distinctBy } from "./utils/arrayUtils";
|
|
63
|
+
|
|
62
64
|
export type {
|
|
63
65
|
IntervalOptions, ProgressOptions, StatusCheckResult, ResultValidation, ValidateResultOptions,
|
|
64
66
|
PhotoInput, PreparedImage, ImageSelector, VideoSaver, AlertFunction, FeatureUtilsConfig, VideoAlertFunction,
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deduplicates an array of objects based on a specific key.
|
|
3
|
+
* Keeps the first occurrence of each item with a unique key.
|
|
4
|
+
*
|
|
5
|
+
* @param array The array to deduplicate
|
|
6
|
+
* @param keyFn A function that returns the unique key for each item
|
|
7
|
+
* @returns A new array with duplicate items removed
|
|
8
|
+
*/
|
|
9
|
+
export const distinctBy = <T>(array: readonly T[], keyFn: (item: T) => string | number): T[] => {
|
|
10
|
+
const seen = new Set<string | number>();
|
|
11
|
+
const result: T[] = [];
|
|
12
|
+
|
|
13
|
+
for (const item of array) {
|
|
14
|
+
const key = keyFn(item);
|
|
15
|
+
if (!seen.has(key)) {
|
|
16
|
+
seen.add(key);
|
|
17
|
+
result.push(item);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return result;
|
|
22
|
+
};
|