Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
open-source
SemWeb
libview
Commits
386f65b7d87a
Commit
f515aa9b
authored
Apr 16, 2021
by
Fabien Amarger
Browse files
feat(prefix): Get prefixed URI from prefix.cc
parent
098fe550ca9e
Pipeline
#49934
passed with stages
in 1 minute and 14 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/index.ts
View file @
386f65b7
...
...
@@ -19,3 +19,4 @@ export interface ViewDescription {
}
export
{
ViewWrapper
}
from
'
./ViewWrapper
'
;
export
{
prefixedNameFromUri
}
from
'
./prefix
'
;
src/prefix.ts
0 → 100644
View file @
386f65b7
export
async
function
prefixedNameFromUri
(
uri
:
string
):
Promise
<
string
>
{
const
resp
=
await
fetch
(
`http://prefix.cc/reverse?uri=
${
encodeURIComponent
(
uri
)}
`
);
let
prefixedUri
=
uri
;
if
(
resp
.
statusText
===
'
OK
'
)
{
// remove "http://prefix.cc/" from the url to get the prefixed URI
prefixedUri
=
resp
.
url
.
substring
(
resp
.
url
.
lastIndexOf
(
'
/
'
)
+
1
);
}
return
prefixedUri
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment