All files / theatres/with-youtube-spotify/utils utils.js

100% Statements 8/8
0% Branches 0/4
100% Functions 4/4
100% Lines 4/4

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39              1090x                 690x                   592x                     100x  
/**
 * isValidAudioFile
 * checks string for valid extension
 *
 * @param {string } trackName
 * @returns { boolean }
 */
export const isValidAudioFile = (trackName = '') => !!trackName.match(/(mp3|ogg|flac|m4a|wma|aiff|aac|aa|ra|ram|shn|wav|wave)$/g);
 
/**
 * isValidImageFile
 * checks string for valid extension
 *
 * @param {string } imageName
 * @returns { boolean }
 */
export const isValidImageFile = (imageName = '') => !!imageName.match(/(png|jpg|jpeg)$/gi);
 
/**
 * isOlderDerivedMP3
 * Older derived MP3s can still exist, and this causes double
 * checks string for valid extension
 *
 * @param {string } trackName
 * @returns { boolean }
 */
export const isOlderDerivedMP3 = (trackName = '') => !!trackName.match(/_vbr.mp3$/g);
 
/**
 * isValidSegmentFile
 * Segment files are what IA uses to break down longer audio files to smaller ones
 * They are created by IA's internal CD & LP ripping software
 * checks string for valid extension
 *
 * @param {string } fileName
 * @returns { boolean }
 */
export const isValidSegmentFile = (fileName = '') => !!fileName.match(/_segments.(json|xml)$/gi);