This function is part of Iconify Utils package.

Function validateIconSet() validates icon set, returning cleaned up IconifyJSON object.

If there are errors in provided data:

  • If error is critical, function will throw an exception.
  • If error can be fixed, function will throw an exception, unless fix option is provided.


Function has the following parameters:

  • data, object. Data to validate.
  • options, object. Optional options object.


Options object has the following properties:

  • fix, boolean. If set to true, function will attempt to fix errors whenver possible instead of throwing exception. Default value is false.
  • prefix, string. Default value for prefix property of icon set. If set, function will overwrite prefix in icon set with your value.
  • provider, string. Default value for provider property of icon set. If set, function will overwrite provider in icon set with your value.


import { promises as fs } from 'fs';
import { validateIconSet } from '@iconify/utils/lib/icon-set/validate';

(async () => {
   // Load data from file
   const data = JSON.parse(
       await fs.readFile(

   // Validate data
   const iconSet = validateIconSet(data);

   // Count icons (simple calculation)
   const count =
       Object.keys(iconSet).length +
       (iconSet.aliases ? Object.keys(iconSet.aliases).length : 0);
   console.log(`Found ${count} icons`);