function toJS(source) {
  const dimension = source.split(path.sep).pop();
  const toIds = _files => {
    const retVal = [];

    _files.forEach(_file => {
      if (_file.endsWith('.svg')) {
        const basename = path.basename(_file, '.svg');
        const suffix = `${dimension}${config.shape.id.separator}${basename}`;
        const id = config.shape.id.generator.replace(/%s/gu, suffix);

        retVal.push(`'${id}'`);
      }
    });

    return retVal;
  };
  const files = fs.readdirSync(source);

  return `/**
 * Copyright Zendesk, Inc.
 *
 * Use of this source code is governed under the Apache License, Version 2.0
 * found at http://www.apache.org/licenses/LICENSE-2.0.
 */

export const SVGs = [\n  ${toIds(files).join(',\n  ')}\n];\n`;
}
/**
 * Convert the given directory of SVG files to an array of SVG IDs.
 *
 * @param {String} source Directory of source SVGs.
 *
 * @returns {String} `Garden.svgIDs = [files-to-IDs];`
 */
Convert the given directory of SVG files to an array of SVG IDs.
@param {String} source Directory of source SVGs.


Convert the given directory of SVG files to an array of SVG IDs . @param { String } source Directory of source SVGs .
function toJS(source) {
  const dimension = source.split(path.sep).pop();
  const toIds = _files => {
    const retVal = [];
    _files.forEach(_file => {
      if (_file.endsWith('.svg')) {
        const basename = path.basename(_file, '.svg');
        const suffix = `${dimension}${config.shape.id.separator}${basename}`;
        const id = config.shape.id.generator.replace(/%s/gu, suffix);
        retVal.push(`'${id}'`);
      }
    });
    return retVal;
  };
  const files = fs.readdirSync(source);
  return `/**
 * Copyright Zendesk, Inc.
 *
 * Use of this source code is governed under the Apache License, Version 2.0
 * found at http://www.apache.org/licenses/LICENSE-2.0.
 */
export const SVGs = [\n  ${toIds(files).join(',\n  ')}\n];\n`;
}
function toJS ( source ) { const dimension = source . split ( path . sep ) . pop ( ) ; const toIds = _files => { const retVal = [ ] ; _files . forEach ( _file => { if ( _file . endsWith ( '.svg' ) ) { const basename = path . basename ( _file , '.svg' ) ; const suffix = ` ${ dimension } ${ config . shape . id . separator } ${ basename } ` ; const id = config . shape . id . generator . replace ( / %s / gu , suffix ) ; retVal . push ( ` ${ id } ` ) ; } } ) ; return retVal ; } ; const files = fs . readdirSync ( source ) ; return ` \n ${ toIds ( files ) . join ( ',\n  ' ) } \n \n ` ; }
Convert the given directory of SVG files to an array of SVG IDs.
Convert the given directory of SVG files to an array of SVG IDs .