One step closer to your destination.
Like an incremental
path.relative()
.Why?
- Walk the file system without messy state. - Works well with functional programming styles. - Flexible about user input.Install
npm install next-path --save
Usage
Get it into your program.const nextPath = require('next-path');
Determine the next path, one step closer to the destination.
console.log(nextPath('a', 'a/b/c')); // => 'a/b'
console.log(nextPath('../', '../../../')); // => '../..'
API
nextPath(from, to)
from
Type:string
The base path that both
to
and the result will be relative to.to
Type:string
The path you want to move one step closer to.
Contributing
See our contributing guidelines for more details.- Fork it.
- Make a feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request.
License
MPL-2.0 © Seth HolladayGo make something, dang it.