MCPcopy
hub / github.com/ionic-team/ionicons / getUrl

Function getUrl

src/components/icon/utils.ts:59–83  ·  view source on GitHub ↗
(i: Icon)

Source from the content-addressed store, hash-verified

57};
58
59export const getUrl = (i: Icon) => {
60 let url = getSrc(i.src);
61 if (url) {
62 return url;
63 }
64
65 url = getName(i.name, i.icon, i.mode, i.ios, i.md);
66 if (url) {
67 return getNamedUrl(url, i);
68 }
69
70 if (i.icon) {
71 url = getSrc(i.icon);
72 if (url) {
73 return url;
74 }
75
76 url = getSrc(i.icon[i.mode]);
77 if (url) {
78 return url;
79 }
80 }
81
82 return null;
83};
84
85const getNamedUrl = (iconName: string, iconEl: Icon) => {
86 const url = getIconMap().get(iconName);

Callers 2

loadIconMethod · 0.90
utils.spec.tsFile · 0.90

Calls 3

getSrcFunction · 0.85
getNameFunction · 0.85
getNamedUrlFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…