Javascript String isAudio()

Description

Javascript String isAudio()


String.prototype.isAudio = function(){
  var possible_audio_exts = ['mp3', 'flac', 'alac', 'aac'], name, ext;
  [name, ext] = this.split('.');
  if ((name == name.replace(/[^A-Za-z]/g,'')) && (ext == ext.toLowerCase())) 
   return possible_audio_exts.indexOf(ext) > -1 ? true : false;
  else return false;
};



PreviousNext

Related