MCPcopy Create free account
hub / github.com/adobe/react-spectrum / getIconNames

Function getIconNames

packages/dev/s2-docs/scripts/generateMarkdownDocs.mjs:1040–1067  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1038}
1039
1040function getIconNames() {
1041 if (iconNamesCache) {
1042 return iconNamesCache;
1043 }
1044
1045 try {
1046 const files = fs.readdirSync(S2_ICON_ROOT);
1047 const names = new Set();
1048
1049 for (const fileName of files) {
1050 if (!fileName.toLowerCase().endsWith('.svg')) {
1051 continue;
1052 }
1053
1054 const normalized = fileName.replace(/^S2_Icon_(.*?)(Size\d+)?_2.*/, '$1');
1055 const cleaned = normalized.trim();
1056 if (cleaned) {
1057 names.add(cleaned);
1058 }
1059 }
1060
1061 iconNamesCache = Array.from(names).sort((a, b) => a.localeCompare(b));
1062 } catch {
1063 iconNamesCache = [];
1064 }
1065
1066 return iconNamesCache;
1067}
1068
1069function getIllustrationNames() {
1070 if (illustrationNamesCache) {

Callers 1

Calls 2

addMethod · 0.65
sortMethod · 0.65

Tested by

no test coverage detected