itube-specs 0.0.584 → 0.0.587

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,7 +1,7 @@
1
1
  {
2
2
  "name": "itube-specs",
3
3
  "type": "module",
4
- "version": "0.0.584",
4
+ "version": "0.0.587",
5
5
  "main": "./nuxt.config.ts",
6
6
  "types": "./types/index.d.ts",
7
7
  "scripts": {
@@ -5,6 +5,7 @@ const PIERCING_NAME = 'tattoos_presence';
5
5
  const TATTOOS_NAME = 'piercings_presence';
6
6
  const parameters = ['height_cm', 'weight_kg', 'star_sign', PIERCING_NAME, TATTOOS_NAME];
7
7
  const iconOnlyParameters = [PIERCING_NAME, TATTOOS_NAME];
8
+ const age = (card: IRawModelCard) => card.parameters.find(item => item.name === 'age')?.values[0].title
8
9
 
9
10
  export const cleanModelCard = (card: IRawModelCard): IModelCard => ({
10
11
  title: card.title || '',
@@ -12,16 +13,18 @@ export const cleanModelCard = (card: IRawModelCard): IModelCard => ({
12
13
  thumbUrl: card.video_thumb_urls?.webp?.[ThumbSize.Big] || '',
13
14
  primaryImageUrl: card.primary_image_url || '',
14
15
  guid: card.guid || '',
15
- age: card.parameters.find(item => item.name === 'age')?.values[0].title || '',
16
- parameters: card.parameters.filter(item => parameters.includes(item.name)).map((item: IModelParameter) => {
17
- if (iconOnlyParameters.includes(item.name)) {
18
- return {
19
- icon: item.name.split('_')[0],
16
+ parameters: [
17
+ ...(age(card) ? [{ title: age(card) }] : []),
18
+ ...card.parameters.filter(item => parameters.includes(item.name) && item.values?.length).map((item: IModelParameter) => {
19
+ if (iconOnlyParameters.includes(item.name)) {
20
+ return {
21
+ icon: item.name.split('_')[0],
22
+ }
20
23
  }
21
- } else {
22
24
  return {
23
- title: item.title,
25
+ title: item.name,
26
+ value: item.values?.[0]?.title,
24
27
  }
25
- }
26
- }) || [],
28
+ }),
29
+ ],
27
30
  });
@@ -8,5 +8,6 @@ export interface IModelCard {
8
8
  parameters: {
9
9
  icon?: string
10
10
  title?: string
11
+ value?: string
11
12
  }[];
12
13
  }