untildify
Advanced tools
Comparing version 4.0.0 to 5.0.0
@@ -6,3 +6,3 @@ /** | ||
``` | ||
import untildify = require('untildify'); | ||
import untildify from 'untildify'; | ||
@@ -13,4 +13,2 @@ untildify('~/dev'); | ||
*/ | ||
declare function untildify(pathWithTilde: string): string; | ||
export = untildify; | ||
export default function untildify(pathWithTilde: string): string; |
@@ -1,7 +0,6 @@ | ||
'use strict'; | ||
const os = require('os'); | ||
import os from 'node:os'; | ||
const homeDirectory = os.homedir(); | ||
module.exports = pathWithTilde => { | ||
export default function untildify(pathWithTilde) { | ||
if (typeof pathWithTilde !== 'string') { | ||
@@ -12,2 +11,2 @@ throw new TypeError(`Expected a string, got ${typeof pathWithTilde}`); | ||
return homeDirectory ? pathWithTilde.replace(/^~(?=$|\/|\\)/, homeDirectory) : pathWithTilde; | ||
}; | ||
} |
{ | ||
"name": "untildify", | ||
"version": "4.0.0", | ||
"version": "5.0.0", | ||
"description": "Convert a tilde path to an absolute path: `~/dev` → `/Users/sindresorhus/dev`", | ||
@@ -10,3 +10,3 @@ "license": "MIT", | ||
"email": "sindresorhus@gmail.com", | ||
"url": "sindresorhus.com" | ||
"url": "https://sindresorhus.com" | ||
}, | ||
@@ -16,7 +16,12 @@ "contributors": [ | ||
], | ||
"type": "module", | ||
"exports": { | ||
"types": "./index.d.ts", | ||
"default": "./index.js" | ||
}, | ||
"engines": { | ||
"node": ">=8" | ||
"node": ">=16" | ||
}, | ||
"scripts": { | ||
"test": "xo && ava && tsd" | ||
"test": "xo && NODE_OPTIONS=--loader=esmock ava && tsd" | ||
}, | ||
@@ -40,7 +45,7 @@ "files": [ | ||
"devDependencies": { | ||
"ava": "^1.4.1", | ||
"rewire": "^4.0.1", | ||
"tsd": "^0.7.2", | ||
"xo": "^0.24.0" | ||
"ava": "^5.3.0", | ||
"esmock": "^2.3.1", | ||
"tsd": "^0.28.1", | ||
"xo": "^0.54.2" | ||
} | ||
} |
@@ -1,17 +0,15 @@ | ||
# untildify [![Build Status](https://travis-ci.org/sindresorhus/untildify.svg?branch=master)](https://travis-ci.org/sindresorhus/untildify) | ||
# untildify | ||
> Convert a tilde path to an absolute path: `~/dev` → `/Users/sindresorhus/dev` | ||
## Install | ||
```sh | ||
npm install untildify | ||
``` | ||
$ npm install untildify | ||
``` | ||
## Usage | ||
```js | ||
const untildify = require('untildify'); | ||
import untildify from 'untildify'; | ||
@@ -22,10 +20,4 @@ untildify('~/dev'); | ||
## Related | ||
See [tildify](https://github.com/sindresorhus/tildify) for the inverse. | ||
## License | ||
MIT © [Sindre Sorhus](https://sindresorhus.com) |
Sorry, the diff of this file is not supported yet
Yes
2931
18
23