convert-info
title: convertIconSetInfo() in Iconify Utils
types:
IconifyInfo: '/docs/types/iconify-info.md'
convertIconSetInfo()
This function is part of Iconify Utils package.
Function [func]convertIconSetInfo() converts and validates icon set information.
Some old icon sets might have information in legacy format, which was created before Iconify projects moved to TypeScript. This function will accept both old and new formats, will convert and validate it and will return correct [type]IconifyInfo data.
Usage
Function has the following parameters:
[prop]data,[type]unknown. Icon set information, which can be legacy object or[type]IconifyInfo.[prop]expectedPrefix,[type]string. Optional. If set, and source object has[prop]prefixproperty with different value, function will throw an error. This can be used legacy information might be incorrect.
Function returns:
[type]IconifyInfoobject on success.[type]nullon error.
Example
src: libraries/utils/convert-info.ts
title: 'usage.ts'
extra:
- src: libraries/utils/convert-info.json
title: 'Result:'
这篇文档对你有帮助吗?
谢谢你的反馈!