nova-ui/utilities/getIPFSPrefix.ts

8 lines
218 B
TypeScript
Raw Permalink Normal View History

2022-12-04 09:02:30 +03:00
const PREFIX_INDEX = 1
const getIPFSPrefix = () => {
const ipfsPathRegExp = /^(\/(?:ipfs|ipns)\/[^/]+)/
return (window.location.pathname.match(ipfsPathRegExp) ?? [])[PREFIX_INDEX] || ''
}
export { getIPFSPrefix }