unchained / src /utils /sortVideosByYoungestFirst.mts
barton
Duplicate from jbilcke-hf/VideoChain-API
53aa97a
raw
history blame contribute delete
260 Bytes
import { Video } from "../types.mts"
// used by the API, to return latest videos at the top
export function sortVideosByYoungestFirst(videos: Video[]) {
videos.sort((a: Video, b: Video) => Date.parse(b.createdAt) - Date.parse(a.createdAt))
return videos
}