MCPcopy Create free account
hub / github.com/dailydotdev/apps / getExtension

Function getExtension

packages/shared/src/lib/video.ts:13–19  ·  view source on GitHub ↗
(url: string)

Source from the content-addressed store, hash-verified

11};
12
13const getExtension = (url: string): string => {
14 // Drop query/hash before reading the extension so cloudinary transform
15 // params (e.g. `?_a=...`) don't hide it.
16 const path = url.split(/[?#]/, 1)[0];
17 const lastDot = path.lastIndexOf('.');
18 return lastDot === -1 ? '' : path.slice(lastDot + 1).toLowerCase();
19};
20
21/**
22 * Detects whether a markdown media URL points to a video file, so `![](url)`

Callers 2

isVideoUrlFunction · 0.85
getVideoMimeTypeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected