function getProcessedPath(file, data) {
  return file.replace(/__([A-Za-z0-9-]+_?[A-Za-z0-9-]+)+__/g, (match) => {
    const dataKey = match.substring(2, match.length - 2);
    const dataVal = data[dataKey];

    if (dataVal) {
      return dataVal;
    }
    return match;
  });
}
function getProcessedPath(file, data) {
  return file.replace(/__([A-Za-z0-9-]+_?[A-Za-z0-9-]+)+__/g, (match) => {
    const dataKey = match.substring(2, match.length - 2);
    const dataVal = data[dataKey];

    if (dataVal) {
      return dataVal;
    }
    return match;
  });
}
function getProcessedPath ( file , data ) { return file . replace ( / __([A-Za-z0-9-]+_?[A-Za-z0-9-]+)+__ / g , ( match ) => { const dataKey = match . substring ( 2 , match . length - 2 ) ; const dataVal = data [ dataKey ] ; if ( dataVal ) { return dataVal ; } return match ; } ) ; }
Gets the processed filepath of a dynamic filepath
@param {String} file - A filepath to search for variables
@param {Object} data - The data to use if a variable is found
Gets the processed filepath of a dynamic filepath