UNPKG
@jsenv/util
Version:
latest (4.1.1)
4.1.1
4.1.0
4.0.6
4.0.5
4.0.4
4.0.3
4.0.2
4.0.1
4.0.0
3.11.0
3.10.0
3.9.2
3.9.1
3.9.0
3.8.0
3.7.3
3.7.2
3.7.1
3.7.0
3.6.3
3.6.2
3.6.1
3.6.0
3.5.2
3.5.1
3.5.0
3.4.1
3.4.0
3.3.4
3.3.3
3.3.2
3.3.1
3.3.0
3.2.0
3.1.0
3.0.0
2.1.0
2.0.0
1.4.0
1.3.0
1.2.0
1.1.0
1.0.0
Set of functions often needed when using Node.js.
github.com/jsenv/jsenv-util
jsenv/jsenv-util
@jsenv/util
/
src
/
fileSystemPathToUrl.js
10 lines
(8 loc)
•
298 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
import
{ pathToFileURL }
from
"url"
import
{ isFileSystemPath }
from
"./isFileSystemPath.js"
export
const
fileSystemPathToUrl
= (
value
) => {
if
(!
isFileSystemPath
(value)) {
throw
new
Error
(
`received an invalid value for fileSystemPath:
${value}
`
) }
return
String
(
pathToFileURL
(value)) }