excel2json/util.js

16 lines
358 B
JavaScript
Raw Normal View History

2021-03-30 11:21:58 +07:00
/**
* Split Filepath to Path and Filename
*
* @param {String} filePath
* @returns Object of JSON
*/
module.exports.splitFilepath = function splitFilepath(filePath) {
const filename = filePath.replace(/^.*[\\\/]/, "");
const path = filePath.replace("/" + filename, "");
return {
path: path == filename ? undefined : path,
filename,
};
}