@oxyhq/core 3.12.0 → 3.13.1
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/dist/cjs/.tsbuildinfo +1 -1
- package/dist/cjs/utils/profileLinks.js +15 -4
- package/dist/esm/.tsbuildinfo +1 -1
- package/dist/esm/utils/profileLinks.js +15 -4
- package/dist/types/.tsbuildinfo +1 -1
- package/dist/types/utils/profileLinks.d.ts +11 -3
- package/package.json +1 -1
- package/src/utils/__tests__/profileLinks.test.ts +56 -2
- package/src/utils/profileLinks.ts +21 -4
|
@@ -13,10 +13,13 @@ function cleanUrl(value) {
|
|
|
13
13
|
* Pure, no side effects, no I/O.
|
|
14
14
|
*
|
|
15
15
|
* - Prefers `linksMetadata` when it is a non-empty array: maps each entry to
|
|
16
|
-
* `{ id, title, url }`, using `entry.id` when present and
|
|
17
|
-
* entry index.
|
|
16
|
+
* `{ id, title, url, description, image }`, using `entry.id` when present and
|
|
17
|
+
* falling back to the entry index. `title`, `description`, and `image` are
|
|
18
|
+
* carried through only when they are present strings. Entries without a
|
|
19
|
+
* non-empty string `url` are dropped.
|
|
18
20
|
* - Otherwise falls back to the legacy `links` string array: maps each string to
|
|
19
|
-
* `{ id: <index>, url }` (no title). Empty/non-string values
|
|
21
|
+
* `{ id: <index>, url }` (no title/description/image). Empty/non-string values
|
|
22
|
+
* are dropped.
|
|
20
23
|
* - Returns `[]` when both are absent or empty (including when `linksMetadata`
|
|
21
24
|
* is present but every entry is dropped — it does NOT fall back to `links`).
|
|
22
25
|
*
|
|
@@ -34,7 +37,15 @@ function normalizeProfileLinks(linksMetadata, links) {
|
|
|
34
37
|
? entry.id
|
|
35
38
|
: String(index);
|
|
36
39
|
const title = typeof entry?.title === 'string' ? entry.title : undefined;
|
|
37
|
-
|
|
40
|
+
const description = typeof entry?.description === 'string' ? entry.description : undefined;
|
|
41
|
+
const image = typeof entry?.image === 'string' ? entry.image : undefined;
|
|
42
|
+
result.push({
|
|
43
|
+
id,
|
|
44
|
+
url,
|
|
45
|
+
...(title !== undefined ? { title } : {}),
|
|
46
|
+
...(description !== undefined ? { description } : {}),
|
|
47
|
+
...(image !== undefined ? { image } : {}),
|
|
48
|
+
});
|
|
38
49
|
});
|
|
39
50
|
return result;
|
|
40
51
|
}
|