index.js 276 B

123456789
  1. var path = require('path');
  2. module.exports = function(npath, ext) {
  3. if (typeof npath !== 'string') return npath;
  4. if (npath.length === 0) return npath;
  5. var nFileName = path.basename(npath, path.extname(npath))+ext;
  6. return path.join(path.dirname(npath), nFileName);
  7. };