Update paths on nestedvfiles
Update nestedvfilepaths in a given vfile's contents. Both update and update.undo return modified copies of the vfile passed to them and don't affect the original.
npm i vfile-update
varvfile=require('vfile')
varupdate=require('vfile-update')
varfile=vfile({
path:'foo',
contents:[
vfile({
path:'bar',
contents:[
vfile({
path:'bar.txt',
contents:'Bar'
})
]
})
]
})
varupdated=update(file)
console.log(updated.contents[0].contents[0].history)
// ['bar.txt', 'foo/bar/bar.txt']
varundone=update.undo(updated)
console.log(undone.contents[0].contents[0].history
// ['bar.txt']
Creates a copy of file and updates paths on its contents. returns the updated copy of file.
returnsVFile
VFile
VFile to work on
Creates a copy of file and undoes update on sub vfile's history.
returnsVFile
VFile
MIT © Paul Zimmer