mz700-js
Version:
MZ-700 Full JavaScript Emulator
12 lines (11 loc) • 334 B
text/typescript
;
import path = require("path");
export default function changeExt(filename:string, ext:string):string {
if(!/^\./.test(ext)) {
ext = '.' + ext;
}
const oldExt:string = path.extname(filename);
const re = new RegExp(`${oldExt}$`);
return filename.replace(re, ext);
}
module.exports = changeExt;