1
|
# expand-tilde [![NPM version](https://img.shields.io/npm/v/expand-tilde.svg?style=flat)](https://www.npmjs.com/package/expand-tilde) [![NPM downloads](https://img.shields.io/npm/dm/expand-tilde.svg?style=flat)](https://npmjs.org/package/expand-tilde) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/expand-tilde.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/expand-tilde)
|
2
|
|
3
|
> Bash-like tilde expansion for node.js. Expands a leading tilde in a file path to the user home directory, or `~+` to the cwd.
|
4
|
|
5
|
## Install
|
6
|
|
7
|
Install with [npm](https://www.npmjs.com/):
|
8
|
|
9
|
```sh
|
10
|
$ npm install --save expand-tilde
|
11
|
```
|
12
|
|
13
|
## Usage
|
14
|
|
15
|
See the [Bash documentation for Tilde Expansion](https://www.gnu.org/software/bash/manual/html_node/Tilde-Expansion.html).
|
16
|
|
17
|
```js
|
18
|
var expandTilde = require('expand-tilde');
|
19
|
|
20
|
expandTilde('~')
|
21
|
//=> '/Users/jonschlinkert'
|
22
|
|
23
|
expandTilde('~+')
|
24
|
//=> process.cwd()
|
25
|
```
|
26
|
|
27
|
## Run tests
|
28
|
|
29
|
Install dev dependencies:
|
30
|
|
31
|
```bash
|
32
|
npm i -d && npm test
|
33
|
```
|
34
|
|
35
|
## About
|
36
|
|
37
|
### Related projects
|
38
|
|
39
|
* [braces](https://www.npmjs.com/package/braces): Fast, comprehensive, bash-like brace expansion implemented in JavaScript. Complete support for the Bash 4.3 braces… [more](https://github.com/jonschlinkert/braces) | [homepage](https://github.com/jonschlinkert/braces "Fast, comprehensive, bash-like brace expansion implemented in JavaScript. Complete support for the Bash 4.3 braces specification, without sacrificing speed.")
|
40
|
* [expand-brackets](https://www.npmjs.com/package/expand-brackets): Expand POSIX bracket expressions (character classes) in glob patterns. | [homepage](https://github.com/jonschlinkert/expand-brackets "Expand POSIX bracket expressions (character classes) in glob patterns.")
|
41
|
* [is-glob](https://www.npmjs.com/package/is-glob): Returns `true` if the given string looks like a glob pattern or an extglob pattern… [more](https://github.com/jonschlinkert/is-glob) | [homepage](https://github.com/jonschlinkert/is-glob "Returns `true` if the given string looks like a glob pattern or an extglob pattern. This makes it easy to create code that only uses external modules like node-glob when necessary, resulting in much faster code execution and initialization time, and a bet")
|
42
|
* [micromatch](https://www.npmjs.com/package/micromatch): Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch. | [homepage](https://github.com/jonschlinkert/micromatch "Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch.")
|
43
|
|
44
|
### Contributing
|
45
|
|
46
|
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
|
47
|
|
48
|
### Building docs
|
49
|
|
50
|
_(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).)_
|
51
|
|
52
|
To generate the readme and API documentation with [verb](https://github.com/verbose/verb):
|
53
|
|
54
|
```sh
|
55
|
$ npm install -g verb verb-generate-readme && verb
|
56
|
```
|
57
|
|
58
|
### Running tests
|
59
|
|
60
|
Install dev dependencies:
|
61
|
|
62
|
```sh
|
63
|
$ npm install -d && npm test
|
64
|
```
|
65
|
|
66
|
### Author
|
67
|
|
68
|
**Jon Schlinkert**
|
69
|
|
70
|
* [github/jonschlinkert](https://github.com/jonschlinkert)
|
71
|
* [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
|
72
|
|
73
|
### License
|
74
|
|
75
|
Copyright © 2016, [Jon Schlinkert](https://github.com/jonschlinkert).
|
76
|
Released under the [MIT license](LICENSE).
|
77
|
|
78
|
***
|
79
|
|
80
|
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.2.0, on December 08, 2016._
|