fnamemodify

fnamemodify() from Vim for Node

fnamemodify

fnamemodify() from Vim for Node.

Modify file name {fname} according to {mods}. {mods} is a string of characters like it is used for file names on the command line. See |filename-modifiers|.

Example:

var fnamemodify = require('fnamemodify') 
 
console.log(fnamemodify("main.c", ":p:h"))
//=> /Users/dttvb/Projects/fnamemodify 

Extract the {mods} from the {fname}.

Example:

console.log(fnamemodify.extract('%:p:s?a?b?'))
//=> { fname: '%', mods: ':p:s?a?b?' }