Socket
Socket
Sign inDemoInstall

tildify

Package Overview
Dependencies
1
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.2.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 str.replace(dir, '~');
return str.replace(userHome, '~');
};
{
"name": "tildify",
"version": "0.2.0",
"description": "Convert an absolute path to tilde path: /Users/sindresorhus/dev => ~/dev",
"version": "1.0.0",
"description": "Convert an absolute path to a tilde path: /Users/sindresorhus/dev => ~/dev",
"license": "MIT",

@@ -16,3 +16,3 @@ "repository": "sindresorhus/tildify",

"scripts": {
"test": "mocha"
"test": "node test.js"
},

@@ -24,10 +24,17 @@ "files": [

"tilde",
"tildify",
"path",
"home",
"dir",
"directory"
"directory",
"user",
"expand",
"unexpand"
],
"dependencies": {
"user-home": "^1.0.0"
},
"devDependencies": {
"mocha": "*"
"ava": "0.0.3"
}
}
# tildify [![Build Status](https://travis-ci.org/sindresorhus/tildify.svg?branch=master)](https://travis-ci.org/sindresorhus/tildify)
> Convert an absolute path to tilde path: `/Users/sindresorhus/dev` => `~/dev`
> Convert an absolute path to a tilde path: `/Users/sindresorhus/dev` => `~/dev`

@@ -8,3 +8,3 @@

```bash
```sh
$ npm install --save tildify

@@ -17,3 +17,3 @@ ```

```js
var tildify = require('tildify');
var tildify = require('tildify');

@@ -25,4 +25,9 @@ tildify('/Users/sindresorhus/dev');

## Related
See [untildify](https://github.com/sindresorhus/untildify) for the inverse.
## License
[MIT](http://opensource.org/licenses/MIT) © [Sindre Sorhus](http://sindresorhus.com)
MIT © [Sindre Sorhus](http://sindresorhus.com)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc