Skip to content

Commit 042b604

Browse files
committed
Fix types
Related to GH-17.
1 parent be7687f commit 042b604

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

lib/index.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
* @typedef {BufferEncoding|{encoding?: null|BufferEncoding, mode: Mode?, flag?: string}} WriteOptions
99
*
1010
* @typedef {string|Uint8Array} Path Path of the file.
11-
* @typedef {typeof import('url').URL} URL WHATWG URL
1211
* @typedef {Path|URL|Options|VFile} Compatible Things that can be
1312
* passed to the function.
1413
*/
@@ -21,7 +20,7 @@
2120

2221
import fs from 'fs'
2322
import path from 'path'
24-
import {fileURLToPath} from 'url'
23+
import {URL, fileURLToPath} from 'url'
2524
import buffer from 'is-buffer'
2625
import {VFile} from 'vfile'
2726

@@ -37,7 +36,7 @@ import {VFile} from 'vfile'
3736
export function toVFile(options) {
3837
if (typeof options === 'string' || buffer(options)) {
3938
options = {path: String(options)}
40-
} else if (options && options.href && options.origin) {
39+
} else if (options instanceof URL) {
4140
options = {path: fileURLToPath(options)}
4241
}
4342

0 commit comments

Comments
 (0)