Skip to content

Commit

Permalink
fix: add icon exists helper
Browse files Browse the repository at this point in the history
  • Loading branch information
snickbit committed Jun 4, 2022
1 parent 1ff0f99 commit d1d6d87
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/utilities/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,13 @@ export function saveConfig(conf) {
return saveFileJson(config_path, _config)
}

export function iconExists(icon: string) {
let config = useConfig()
let iconName = cleanIconName(icon)
const reg = new RegExp(`^fa[a-z]?:(${iconName})$`)
return config.icons.find(i => reg.test(i))
}

export function cleanIconName(icon_name: string): string {
return icon_name.replace(/(fa[a-z]?)[-:]/, '')
}
Expand Down

0 comments on commit d1d6d87

Please sign in to comment.