next-path

2018-10-13 admin

next-path是什么

什么是next-path,One step closer to your destination.

next-path使用教程帮助文档

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.

本站文章除注明转载外,均为本站原创或编译。欢迎任何形式的转载,但请务必注明出处。

转载请注明:文章转载自 JavaScript中文网 [https://www.javascriptcn.com]

本文地址:https://www.javascriptcn.com/read-42564.html

文章标题:next-path

回到顶部