@kitmi/utils
Version:
A JavaScript utility library for both server and browser
24 lines (23 loc) • 627 B
JavaScript
/**
* Split the base and extension (including the ".") of a file path.
* @param {*} filePath
* @returns (array) [base, ext]
*/ "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "default", {
enumerable: true,
get: function() {
return _default;
}
});
const splitBaseAndExt = (filePath)=>{
const pos = filePath.lastIndexOf('.');
return [
pos === -1 ? filePath : filePath.substring(0, pos),
pos === -1 ? '' : filePath.substring(pos)
];
};
const _default = splitBaseAndExt;
//# sourceMappingURL=splitBaseAndExt.js.map