src/files.js
function replaceKeys(searchString, replacement) {
  const replacementKeys = {
    COMPONENT_NAME: replacement,
    component_name: replacement.toLowerCase(),
    COMPONENT_CAP_NAME: replacement.toUpperCase(),
    cOMPONENT_NAME: replacement[0].toLowerCase() + replacement.substr(1),
  }

  return Object.keys(replacementKeys).reduce(
    (acc, curr) => {
      if (acc.includes(curr)) {
        const regEx = new RegExp(curr, 'g')
        return acc.replace(regEx, replacementKeys[curr])
      }
      return acc
    },
    searchString
  )
}
function replaceKeys(searchString, replacement) {
  const replacementKeys = {
    COMPONENT_NAME: replacement,
    component_name: replacement.toLowerCase(),
    COMPONENT_CAP_NAME: replacement.toUpperCase(),
    cOMPONENT_NAME: replacement[0].toLowerCase() + replacement.substr(1),
  }

  return Object.keys(replacementKeys).reduce(
    (acc, curr) => {
      if (acc.includes(curr)) {
        const regEx = new RegExp(curr, 'g')
        return acc.replace(regEx, replacementKeys[curr])
      }
      return acc
    },
    searchString
  )
}
function replaceKeys ( searchString , replacement ) { const replacementKeys = { COMPONENT_NAME : replacement , component_name : replacement . toLowerCase ( ) , COMPONENT_CAP_NAME : replacement . toUpperCase ( ) , cOMPONENT_NAME : replacement [ 0 ] . toLowerCase ( ) + replacement . substr ( 1 ) , } return Object . keys ( replacementKeys ) . reduce ( ( acc , curr ) => { if ( acc . includes ( curr ) ) { const regEx = new RegExp ( curr , 'g' ) return acc . replace ( regEx , replacementKeys [ curr ] ) } return acc } , searchString ) }
generate the file name
@param {string} searchString
@param {string} replacement
generate the file name