MCPcopy
hub / github.com/majodev/google-webfonts-helper / transform

Function transform

server/logic/fetchGoogleFonts.ts:72–88  ·  view source on GitHub ↗
(resData: IGoogleFontsRes)

Source from the content-addressed store, hash-verified

70}
71
72function transform(resData: IGoogleFontsRes): IFontItem[] {
73 return _.map(resData.items, (item, index) => {
74 return {
75 id: speakingurl(item.family),
76 family: item.family,
77 variants: item.variants,
78 subsets: item.subsets,
79 category: item.category,
80 version: item.version,
81 lastModified: item.lastModified,
82 popularity: index + 1, // property order by popularity -> index
83 // use latin per default, else first found font
84 defSubset: _.includes(item.subsets, "latin") ? "latin" : item.subsets[0],
85 defVariant: _.includes(item.variants, "regular") ? "regular" : item.variants[0],
86 };
87 });
88}

Callers 1

fetchGoogleFontsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected