Skip to content

mrzmmr/vfile-update

Repository files navigation

vfile-update

Update paths on nestedvfiles

Travis Coveralls github David

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.

install

npm i vfile-update

usage

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']

api

update (file)

Creates a copy of file and updates paths on its contents. returns the updated copy of file.

returnsVFile

file

VFile VFile to work on

update#undo (file)

Creates a copy of file and undoes update on sub vfile's history.

returnsVFile

file

VFile

License

MIT © Paul Zimmer

About

update paths on nested vfiles

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published