https://github.com/gavinning/paths
根据路径创建路径对象
https://github.com/gavinning/paths
Last synced: 10 months ago
JSON representation
根据路径创建路径对象
- Host: GitHub
- URL: https://github.com/gavinning/paths
- Owner: gavinning
- Created: 2017-04-27T11:06:40.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-05-01T05:00:11.000Z (over 8 years ago)
- Last Synced: 2024-04-26T03:03:54.747Z (over 1 year ago)
- Language: JavaScript
- Size: 4.88 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
Paths
---
### Node
```sh
npm i root-paths --save
```
### Project
```
project
├── a
│ ├── a.js
│ └── c
│ └── c.js
├── b
│ └── b.js
└── ins.js
```
### Usage
```js
// ins.js
const Paths = require('root-paths')
global.paths = new Paths(__dirname)
require(paths.a.a) == require('./a/a')
require(paths.b.b) == require('./b/b')
require(paths.a.c.c) == require('./a/c/c')
```
#### Options
```js
{
root: __dirname, // 项目根目录
folders: [], // 执行要查询的子目录
filter: ['**/node_modules/**'] // 过滤条件,请参考 glob
}
```