Created
August 25, 2017 12:59
-
-
Save J2D2Development/3c5e08825b654e6c0350b4be7c077bba to your computer and use it in GitHub Desktop.
Insert new string into path
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
module.exports = function(filePath, additionalName) { | |
const filePathArray = filePath.split('.'); | |
const lastItemInPath = filePathArray[filePathArray.length - 2]; | |
filePathArray[filePathArray.length - 2] = `${lastItemInPath}-${additionalName}`; | |
return filePathArray.join('.'); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment