Skip to content

Commit

Permalink
[front] chore: remove unused function and type
Browse files Browse the repository at this point in the history
  • Loading branch information
GresilleSiffle committed Apr 30, 2024
1 parent 4334024 commit 605fa49
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 27 deletions.
2 changes: 0 additions & 2 deletions frontend/src/utils/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
Recommendation,
RelatedEntity,
TournesolUserSettings,
Video,
EntityNoExtraField,
} from 'src/services/openapi';

Expand Down Expand Up @@ -39,7 +38,6 @@ export type EntityResult =
| Recommendation
| SimpleEntityResult;
export type EntityObject = RelatedEntity | EntityNoExtraField;
export type VideoObject = Video;

/**
* An exhaustive list of route ids helping to enforce type checking in each
Expand Down
25 changes: 0 additions & 25 deletions frontend/src/utils/video.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { VideoObject } from './types';

export function extractVideoId(
idOrUrl: string,
{ ignoreVideoId = false } = {}
Expand Down Expand Up @@ -38,29 +36,6 @@ export function isVideoIdValid(videoId: string) {
return !!videoId.match(/^[A-Za-z0-9-_]{11}$/);
}

/**
* Return the video id of an entity.
*
* If no field `uid` is found, return the value of the legacy `video_id`
* field instead.
*
* The `uid` is expected to have the form `{namespace}:{id}`. The potential
* occurrences of the delimiter `:` in the identifier are considered part of it.
*
* Example with different `uid`:
*
* yt:videoABCDEF -> videoABCDEF
* yt:video:ABCDE -> video:ABCDE
*/
export function videoIdFromEntity(entity: VideoObject): string {
if (entity.uid) {
const id = idFromUid(entity.uid);
if (id) return id;
}

return entity.video_id;
}

export function idFromUid(uid: string): string {
if (uid) {
const uidSplit = uid.split(':');
Expand Down

0 comments on commit 605fa49

Please sign in to comment.