node package manager
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

fnamemodify

fnamemodify

fnamemodify() from Vim for Node.

fnamemodify({fname}, {mods})

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 

fnamemodify.extract({fname}{mods})

Extract the {mods} from the {fname}.

Example:

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