MCPcopy Create free account
hub / github.com/formkit/formkit / getIcons

Function getIcons

scripts/utils.mjs:90–103  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

88 * Get the available icons from the icons directory.
89 */
90export function getIcons() {
91 const iconFiles = getAllFiles(resolve(packagesDir, 'icons/src/icons'))
92 const icons = {}
93 iconFiles.forEach((filePath) => {
94 const extension = extname(filePath)
95 if (extension !== '.ts') return
96 const file = basename(filePath, extension)
97 const name = toCamelCase(file)
98 let data = fs.readFileSync(filePath, 'utf8')
99 data = data.replace('export default `', '').replace('</svg>`', '</svg>')
100 icons[name] = data
101 })
102 return icons
103}
104
105/**
106 * Get all the plugin directories in the themes package at provided path

Callers 1

buildPackageFunction · 0.90

Calls 2

getAllFilesFunction · 0.85
toCamelCaseFunction · 0.85

Tested by

no test coverage detected