Socket
Socket
Sign inDemoInstall

untildify

Package Overview
Dependencies
0
Maintainers
2
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.0.3 to 4.0.0

index.d.ts

11

index.js
'use strict';
const os = require('os');
const home = require('os').homedir();
const homeDirectory = os.homedir();
module.exports = str => {
if (typeof str !== 'string') {
throw new TypeError(`Expected a string, got ${typeof str}`);
module.exports = pathWithTilde => {
if (typeof pathWithTilde !== 'string') {
throw new TypeError(`Expected a string, got ${typeof pathWithTilde}`);
}
return home ? str.replace(/^~(?=$|\/|\\)/, home) : str;
return homeDirectory ? pathWithTilde.replace(/^~(?=$|\/|\\)/, homeDirectory) : pathWithTilde;
};
{
"name": "untildify",
"version": "3.0.3",
"description": "Convert a tilde path to an absolute path: ~/dev => /Users/sindresorhus/dev",
"license": "MIT",
"repository": "sindresorhus/untildify",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"contributors": [
"silverwind <me@silverwind.io> (https://silverwind.io)"
],
"engines": {
"node": ">=4"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js"
],
"keywords": [
"tilde",
"expansion",
"expand",
"untildify",
"path",
"home",
"dir",
"directory",
"user",
"shell",
"bash"
],
"devDependencies": {
"ava": "*",
"xo": "*"
},
"xo": {
"esnext": true
}
"name": "untildify",
"version": "4.0.0",
"description": "Convert a tilde path to an absolute path: `~/dev` → `/Users/sindresorhus/dev`",
"license": "MIT",
"repository": "sindresorhus/untildify",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"contributors": [
"silverwind <me@silverwind.io> (https://silverwind.io)"
],
"engines": {
"node": ">=8"
},
"scripts": {
"test": "xo && ava && tsd"
},
"files": [
"index.js",
"index.d.ts"
],
"keywords": [
"tilde",
"expansion",
"expand",
"untildify",
"path",
"home",
"directory",
"user",
"shell",
"bash"
],
"devDependencies": {
"ava": "^1.4.1",
"rewire": "^4.0.1",
"tsd": "^0.7.2",
"xo": "^0.24.0"
}
}
# untildify [![Build Status](https://travis-ci.org/sindresorhus/untildify.svg?branch=master)](https://travis-ci.org/sindresorhus/untildify)
> Convert a tilde path to an absolute path: `~/dev` => `/Users/sindresorhus/dev`
> Convert a tilde path to an absolute path: `~/dev` → `/Users/sindresorhus/dev`

@@ -9,3 +9,3 @@

```
$ npm install --save untildify
$ npm install untildify
```

@@ -12,0 +12,0 @@

Sorry, the diff of this file is not supported yet

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