untildify
Advanced tools
Comparing version 0.1.0 to 1.0.0
10
index.js
'use strict'; | ||
var userHome = require('user-home'); | ||
module.exports = function (str) { | ||
var dir = process.env.HOME; | ||
if (process.platform === 'win32') { | ||
dir = dir || process.env.USERPROFILE || process.env.HOMEDRIVE + process.env.HOMEPATH; | ||
} | ||
return dir ? str.replace(/^~\//, dir + '/') : str; | ||
return userHome ? str.replace(/^~\//, userHome + '/') : str; | ||
}; |
{ | ||
"name": "untildify", | ||
"version": "0.1.0", | ||
"version": "1.0.0", | ||
"description": "Convert a tilde path to an absolute path: ~/dev => /Users/sindresorhus/dev", | ||
@@ -16,3 +16,3 @@ "license": "MIT", | ||
"scripts": { | ||
"test": "mocha" | ||
"test": "node test.js" | ||
}, | ||
@@ -24,2 +24,3 @@ "files": [ | ||
"tilde", | ||
"untildify", | ||
"path", | ||
@@ -29,7 +30,11 @@ "home", | ||
"directory", | ||
"expand" | ||
"expand", | ||
"user" | ||
], | ||
"dependencies": { | ||
"user-home": "^1.0.0" | ||
}, | ||
"devDependencies": { | ||
"mocha": "*" | ||
"ava": "0.0.3" | ||
} | ||
} |
@@ -5,8 +5,6 @@ # untildify [![Build Status](https://travis-ci.org/sindresorhus/untildify.svg?branch=master)](https://travis-ci.org/sindresorhus/untildify) | ||
See the [tildify](https://github.com/sindresorhus/tildify) module for the inverse. | ||
## Install | ||
```bash | ||
```sh | ||
$ npm install --save untildify | ||
@@ -26,4 +24,9 @@ ``` | ||
## Related | ||
See [tildify](https://github.com/sindresorhus/tildify) for the inverse. | ||
## License | ||
MIT © [Sindre Sorhus](http://sindresorhus.com) |
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
0
31
1364
1
5
+ Addeduser-home@^1.0.0
+ Addeduser-home@1.1.1(transitive)