plugins/rekit-react/utils.js
function parseElePath(elePath, type = 'component') {
  const arr = elePath.split('/');
  const feature = _.kebabCase(arr.shift());
  let name = arr.pop();
  if (type === 'action') name = _.camelCase(name);
  else if (type === 'component') name = pascalCase(name);
  else throw new Error('Unknown element type: ' + type + ' of ' + elePath);
  elePath = [feature, ...arr, name].join('/');

  const ele = {
    name,
    path: elePath,
    feature,
  };

  if (type === 'component') {
    ele.modulePath = `src/features/${elePath}.js`;
    ele.testPath = `tests/features/${elePath}.test.js`;
    ele.stylePath = `src/features/${elePath}.${config.getRekitConfig().css}`;
  } else if (type === 'action') {
    ele.modulePath = `src/features/${feature}/redux/${name}.js`;
    ele.testPath = `tests/features/${feature}/redux/${name}.test.js`;
  }
  return ele;
}
function parseElePath(elePath, type = 'component') {
  const arr = elePath.split('/');
  const feature = _.kebabCase(arr.shift());
  let name = arr.pop();
  if (type === 'action') name = _.camelCase(name);
  else if (type === 'component') name = pascalCase(name);
  else throw new Error('Unknown element type: ' + type + ' of ' + elePath);
  elePath = [feature, ...arr, name].join('/');

  const ele = {
    name,
    path: elePath,
    feature,
  };

  if (type === 'component') {
    ele.modulePath = `src/features/${elePath}.js`;
    ele.testPath = `tests/features/${elePath}.test.js`;
    ele.stylePath = `src/features/${elePath}.${config.getRekitConfig().css}`;
  } else if (type === 'action') {
    ele.modulePath = `src/features/${feature}/redux/${name}.js`;
    ele.testPath = `tests/features/${feature}/redux/${name}.test.js`;
  }
  return ele;
}
function parseElePath ( elePath , type = 'component' ) { const arr = elePath . split ( '/' ) ; const feature = _ . kebabCase ( arr . shift ( ) ) ; let name = arr . pop ( ) ; if ( type === 'action' ) name = _ . camelCase ( name ) ; else if ( type === 'component' ) name = pascalCase ( name ) ; else throw new Error ( 'Unknown element type: ' + type + ' of ' + elePath ) ; elePath = [ feature , ... arr , name ] . join ( '/' ) ; const ele = { name , path : elePath , feature , } ; if ( type === 'component' ) { ele . modulePath = ` ${ elePath } ` ; ele . testPath = ` ${ elePath } ` ; ele . stylePath = ` ${ elePath } ${ config . getRekitConfig ( ) . css } ` ; } else if ( type === 'action' ) { ele . modulePath = ` ${ feature } ${ name } ` ; ele . testPath = ` ${ feature } ${ name } ` ; } return ele ; }
Parse and normalize an element paths, names
Parse and normalize an element paths names