diff options
Diffstat (limited to 'resources/app/node_modules/modify-filename/index.js')
-rw-r--r-- | resources/app/node_modules/modify-filename/index.js | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/resources/app/node_modules/modify-filename/index.js b/resources/app/node_modules/modify-filename/index.js new file mode 100644 index 0000000..1c53fba --- /dev/null +++ b/resources/app/node_modules/modify-filename/index.js @@ -0,0 +1,17 @@ +'use strict'; +var path = require('path'); + +module.exports = function modifyFilename(pth, modifier) { + if (arguments.length !== 2) { + throw new Error('`path` and `modifier` required'); + } + + if (Array.isArray(pth)) { + return pth.map(function (el) { + return modifyFilename(el, modifier); + }); + } + + var ext = path.extname(pth); + return path.join(path.dirname(pth), modifier(path.basename(pth, ext), ext)); +}; |