wallet-core/node_modules/replace-ext/index.js

19 lines
338 B
JavaScript
Raw Normal View History

2016-11-03 01:33:53 +01:00
'use strict';
2016-10-10 03:43:44 +02:00
var path = require('path');
2016-11-03 01:33:53 +01:00
function replaceExt(npath, ext) {
if (typeof npath !== 'string') {
return npath;
}
if (npath.length === 0) {
return npath;
}
2016-10-10 03:43:44 +02:00
2016-11-03 01:33:53 +01:00
var nFileName = path.basename(npath, path.extname(npath)) + ext;
2016-10-10 03:43:44 +02:00
return path.join(path.dirname(npath), nFileName);
2016-11-03 01:33:53 +01:00
}
module.exports = replaceExt;