1.0.0 • Published 7 years ago

next-path v1.0.0

Weekly downloads
6,588
License
MPL-2.0
Repository
github
Last release
7 years ago

next-path Build status for next-path on Circle CI.

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.

  1. Fork it.
  2. Make a feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request.

License

MPL-2.0 © Seth Holladay

Go make something, dang it.