src/font-generator.js
async function generateFonts (options = {}) {
  if (!options.fontName) throw new TypeError('Missing fontName argument');
  if (!options.icons || !Array.isArray(options.icons) || !options.icons.length) { throw new TypeError('Invalid or empty icons argument'); }
  // Store created tasks to match dependencies.
  let genTasks = {};

  /**
   * First, creates tasks for dependent font types.
   * Then creates task for specified font type and chains it to dependencies promises.
   * If some task already exists, it reuses it.
   */
  const makeGenTask = type => {
    // If already defined return.
    if (genTasks[type]) return genTasks[type];

    // Get generator function.
    const gen = generators[type];
    // Create dependent functions
    const depsTasks = (gen.deps || []).map(depType => makeGenTask(depType));
    const task = Promise.all(depsTasks).then(results =>
      gen.fn(options, results)
    );

    genTasks[type] = task;
    return task;
  };

  // Make a gen task for each type.
  const types = ['svg', 'ttf', 'woff', 'woff2'];
  const tasks = types.map(type => {
    return makeGenTask(type);
  });

  const results = await Promise.all(tasks);
  return zipObject(types, results);
}
async function generateFonts (options = {}) {
  if (!options.fontName) throw new TypeError('Missing fontName argument');
  if (!options.icons || !Array.isArray(options.icons) || !options.icons.length) { throw new TypeError('Invalid or empty icons argument'); }
  // Store created tasks to match dependencies.
  let genTasks = {};

  /**
   * First, creates tasks for dependent font types.
   * Then creates task for specified font type and chains it to dependencies promises.
   * If some task already exists, it reuses it.
   */
  const makeGenTask = type => {
    // If already defined return.
    if (genTasks[type]) return genTasks[type];

    // Get generator function.
    const gen = generators[type];
    // Create dependent functions
    const depsTasks = (gen.deps || []).map(depType => makeGenTask(depType));
    const task = Promise.all(depsTasks).then(results =>
      gen.fn(options, results)
    );

    genTasks[type] = task;
    return task;
  };

  // Make a gen task for each type.
  const types = ['svg', 'ttf', 'woff', 'woff2'];
  const tasks = types.map(type => {
    return makeGenTask(type);
  });

  const results = await Promise.all(tasks);
  return zipObject(types, results);
}
async function generateFonts ( options = { } ) { if ( ! options . fontName ) throw new TypeError ( 'Missing fontName argument' ) ; if ( ! options . icons || ! Array . isArray ( options . icons ) || ! options . icons . length ) { throw new TypeError ( 'Invalid or empty icons argument' ) ; } // Store created tasks to match dependencies. let genTasks = { } ; /**
   * First, creates tasks for dependent font types.
   * Then creates task for specified font type and chains it to dependencies promises.
   * If some task already exists, it reuses it.
   */ const makeGenTask = type => { // If already defined return. if ( genTasks [ type ] ) return genTasks [ type ] ; // Get generator function. const gen = generators [ type ] ; // Create dependent functions const depsTasks = ( gen . deps || [ ] ) . map ( depType => makeGenTask ( depType ) ) ; const task = Promise . all ( depsTasks ) . then ( results => gen . fn ( options , results ) ) ; genTasks [ type ] = task ; return task ; } ; // Make a gen task for each type. const types = [ 'svg' , 'ttf' , 'woff' , 'woff2' ] ; const tasks = types . map ( type => { return makeGenTask ( type ) ; } ) ; const results = await Promise . all ( tasks ) ; return zipObject ( types , results ) ; }
Generated the svg, ttf, woff, and woff2 fonts.

@param {object} options Configuration
@param {string} options.fontName Name of the font.
@param {array} options.icons List of icons. Each should have a `name` and
`codepoint` properties.boolean
@param {object} options.formatOptions Configuration for each of the font
generation plugins

@returns {object} Object keyed with the font type and respective content.
All fonts are returned in Buffer format.
Generated the svg ttf woff and woff2 fonts .