notonthehighstreet/breadboard

View on GitHub
lib/getModuleKey.js

Summary

Maintainability
A
0 mins
Test Coverage
'use strict';

const getModuleFilename = (parsedFileName) => {
  return parsedFileName[parsedFileName.ext === '.js' ? 'name' : 'base'];
};

const buildModulePath = (relativeModulePath) => {
  return '/' + (relativeModulePath ? relativeModulePath + '/' : '');
};

module.exports = (relativeModulePath, parsedModulePath) => {
  return buildModulePath(relativeModulePath) + getModuleFilename(parsedModulePath);
};