itube-specs 0.0.694 → 0.0.696
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
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import type { IRawModelCard, IModelCard, IModelParameter } from '../../../types';
|
|
2
2
|
import { ThumbSize } from '../../enums/thumb-size';
|
|
3
3
|
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const parameters = ['height_cm', 'weight_kg', PIERCING_NAME, TATTOOS_NAME];
|
|
7
|
-
const iconOnlyParameters = [PIERCING_NAME, TATTOOS_NAME];
|
|
8
|
-
const age = (card: IRawModelCard) => card.parameters.find(item => item.name === 'age')?.values[0].title
|
|
4
|
+
const parameterNames = ['height_cm', 'weight_kg'];
|
|
5
|
+
const age = (card: IRawModelCard) => card.parameters.find(item => item.name === 'age')?.values[0].title;
|
|
9
6
|
|
|
10
7
|
export const cleanModelCard = (card: IRawModelCard): IModelCard => ({
|
|
11
8
|
title: card.title || '',
|
|
@@ -16,24 +13,15 @@ export const cleanModelCard = (card: IRawModelCard): IModelCard => ({
|
|
|
16
13
|
country: {
|
|
17
14
|
title: card.parameters?.find(item => item.name === 'birthplace_country')?.values[0].title || '',
|
|
18
15
|
name: card.parameters?.find(item => item.name === 'birthplace_country')?.values[0].name || '',
|
|
19
|
-
}
|
|
16
|
+
},
|
|
20
17
|
parameters: [
|
|
21
18
|
...(age(card) ? [{
|
|
22
19
|
title: 'age',
|
|
23
20
|
value: age(card),
|
|
24
21
|
}] : []),
|
|
25
|
-
...card.parameters.filter(item =>
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
title: item.name,
|
|
30
|
-
value: item.values?.[0]?.name,
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
return {
|
|
34
|
-
title: item.name,
|
|
35
|
-
value: item.values?.[0]?.title,
|
|
36
|
-
}
|
|
37
|
-
}),
|
|
22
|
+
...card.parameters.filter(item => parameterNames.includes(item.name) && item.values?.length).map((item: IModelParameter) => ({
|
|
23
|
+
title: item.name,
|
|
24
|
+
value: item.values?.[0]?.title,
|
|
25
|
+
})),
|
|
38
26
|
],
|
|
39
27
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { IRawPlaylistsUser, IPlaylistCard } from '../../../types';
|
|
2
|
+
import { ThumbSize } from '../../enums/thumb-size';
|
|
2
3
|
|
|
3
4
|
export const cleanUserPlaylistCard = (card: IRawPlaylistsUser): IPlaylistCard => ({
|
|
4
5
|
created: card.created || 0,
|
|
@@ -6,7 +7,11 @@ export const cleanUserPlaylistCard = (card: IRawPlaylistsUser): IPlaylistCard =>
|
|
|
6
7
|
name: card.name || '',
|
|
7
8
|
username: card.username || '',
|
|
8
9
|
playlistType: card.playlistType || '',
|
|
9
|
-
thumbUrls: card.thumbs?.slice(0, 4)
|
|
10
|
+
thumbUrls: card.thumbs?.slice(0, 4).map(url => ({
|
|
11
|
+
webp: {
|
|
12
|
+
[ThumbSize.Small]: url,
|
|
13
|
+
},
|
|
14
|
+
})) || [],
|
|
10
15
|
videosCount: card.videoCount || 0,
|
|
11
16
|
firstVideoId: card.firstVideoID || '',
|
|
12
17
|
})
|