Skip to content

Commit

Permalink
Update vfile
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Aug 20, 2021
1 parent e53c05c commit 4076c28
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

import fs from 'fs'
import path from 'path'
import {URL, fileURLToPath} from 'url'
import {URL} from 'url'
import buffer from 'is-buffer'
import {VFile} from 'vfile'

Expand All @@ -34,10 +34,10 @@ import {VFile} from 'vfile'
* @returns {VFile}
*/
export function toVFile(options) {
if (typeof options === 'string' || buffer(options)) {
if (typeof options === 'string' || options instanceof URL) {
options = {path: options}
} else if (buffer(options)) {
options = {path: String(options)}
} else if (options instanceof URL) {
options = {path: fileURLToPath(options)}
}

return looksLikeAVFile(options) ? options : new VFile(options)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
],
"dependencies": {
"is-buffer": "^2.0.0",
"vfile": "^5.0.0"
"vfile": "^5.1.0"
},
"devDependencies": {
"@types/tape": "^4.0.0",
Expand Down

0 comments on commit 4076c28

Please sign in to comment.