Projekt

Obecné

Profil

Stáhnout (3.29 KB) Statistiky
| Větev: | Revize:
1
# resolve-dir [![NPM version](https://img.shields.io/npm/v/resolve-dir.svg?style=flat)](https://www.npmjs.com/package/resolve-dir) [![NPM downloads](https://img.shields.io/npm/dm/resolve-dir.svg?style=flat)](https://npmjs.org/package/resolve-dir) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/resolve-dir.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/resolve-dir)
2

    
3
> Resolve a directory that is either local, global or in the user's home directory.
4

    
5
## Install
6

    
7
Install with [npm](https://www.npmjs.com/):
8

    
9
```sh
10
$ npm install --save resolve-dir
11
```
12

    
13
## Usage
14

    
15
```js
16
var resolve = require('resolve-dir');
17
```
18

    
19
Returns a local directory path unchanged
20

    
21
```js
22
resolve('a')
23
//=> 'a'
24
```
25

    
26
Resolves the path to user home
27

    
28
```js
29
resolve('~')
30
//=> '/Users/jonschlinkert'
31
resolve('~/foo')
32
//=> '/Users/jonschlinkert/foo'
33
```
34

    
35
Resolves the path to global npm modules
36

    
37
```js
38
resolve('@')
39
//=> '/usr/local/lib/node_modules'
40
resolve('@/foo')
41
//=> '/usr/local/lib/node_modules/foo'
42
```
43

    
44
## About
45

    
46
### Related projects
47

    
48
* [expand-tilde](https://www.npmjs.com/package/expand-tilde): Bash-like tilde expansion for node.js. Expands a leading tilde in a file path to the… [more](https://github.com/jonschlinkert/expand-tilde) | [homepage](https://github.com/jonschlinkert/expand-tilde "Bash-like tilde expansion for node.js. Expands a leading tilde in a file path to the user home directory, or `~+` to the cwd.")
49
* [findup-sync](https://www.npmjs.com/package/findup-sync): Find the first file matching a given pattern in the current directory or the nearest… [more](https://github.com/cowboy/node-findup-sync) | [homepage](https://github.com/cowboy/node-findup-sync "Find the first file matching a given pattern in the current directory or the nearest ancestor directory.")
50
* [resolve-modules](https://www.npmjs.com/package/resolve-modules): Resolves local and global npm modules that match specified patterns, and returns a configuration object… [more](https://github.com/jonschlinkert/resolve-modules) | [homepage](https://github.com/jonschlinkert/resolve-modules "Resolves local and global npm modules that match specified patterns, and returns a configuration object for each resolved module.")
51

    
52
### Contributing
53

    
54
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
55

    
56
### Building docs
57

    
58
_(This document was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme) (a [verb](https://github.com/verbose/verb) generator), please don't edit the readme directly. Any changes to the readme must be made in [.verb.md](.verb.md).)_
59

    
60
To generate the readme and API documentation with [verb](https://github.com/verbose/verb):
61

    
62
```sh
63
$ npm install -g verb verb-generate-readme && verb
64
```
65

    
66
### Running tests
67

    
68
Install dev dependencies:
69

    
70
```sh
71
$ npm install -d && npm test
72
```
73

    
74
### Author
75

    
76
**Jon Schlinkert**
77

    
78
* [github/jonschlinkert](https://github.com/jonschlinkert)
79
* [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
80

    
81
### License
82

    
83
Copyright © 2016, [Jon Schlinkert](https://github.com/jonschlinkert).
84
Released under the [MIT license](https://github.com/jonschlinkert/resolve-dir/blob/master/LICENSE).
85

    
86
***
87

    
88
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.2.0, on October 18, 2016._
(2-2/4)