lib/helpers/indexes.js
function createStrings(input) {
  return new Promise((resolve, reject) => {
    try {
      if (!input) {
        return resolve(null);
      }

      const importsString = input.imports.length ? `${input.imports.join('\n')}\n\n` : '';
      const exportsString = input.exports.length ? `${input.exports.join('\n')}\n` : '';
      const indexString = `${importsString}${exportsString}`.replace('\n\n\n', '\n\n');

      return resolve(indexString.length ? indexString : null);
    } catch (e) {
      return reject(new Error(t('STRINGS_COULD_NOT_BE_CREATED')));
    }
  });
}
function createStrings(input) {
  return new Promise((resolve, reject) => {
    try {
      if (!input) {
        return resolve(null);
      }

      const importsString = input.imports.length ? `${input.imports.join('\n')}\n\n` : '';
      const exportsString = input.exports.length ? `${input.exports.join('\n')}\n` : '';
      const indexString = `${importsString}${exportsString}`.replace('\n\n\n', '\n\n');

      return resolve(indexString.length ? indexString : null);
    } catch (e) {
      return reject(new Error(t('STRINGS_COULD_NOT_BE_CREATED')));
    }
  });
}
function createStrings ( input ) { return new Promise ( ( resolve , reject ) => { try { if ( ! input ) { return resolve ( null ) ; } const importsString = input . imports . length ? ` ${ input . imports . join ( '\n' ) } \n \n ` : '' ; const exportsString = input . exports . length ? ` ${ input . exports . join ( '\n' ) } \n ` : '' ; const indexString = ` ${ importsString } ${ exportsString } ` . replace ( '\n\n\n' , '\n\n' ) ; return resolve ( indexString . length ? indexString : null ) ; } catch ( e ) { return reject ( new Error ( t ( 'STRINGS_COULD_NOT_BE_CREATED' ) ) ) ; } } ) ; }
Creates the string that is written into the appropriate file.
@param {Object} input The input object.
@return {string}
Creates the string that is written into the appropriate file .