{"size": 796, "ext": "js", "max_stars_repo_path": "cli/helpers/videos.js", "max_stars_repo_name": "tfentonz/avc_website", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "cli/helpers/videos.js", "max_issues_repo_name": "tfentonz/avc_website", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "cli/helpers/videos.js", "max_forks_repo_name": "tfentonz/avc_website", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 23.4117647059, "max_line_length": 68, "alphanum_fraction": 0.6180904523}
export function isVideoMissingDetails (video) {
  return [
    'service',
    'videoId',
    'tags',
    'title',
    'description',
    'date',
    'duration'
  ].some((property) => !Object.hasOwnProperty.call(video, property))
}

/**
 * Converts Youtube duration format to seconds
 * Examples of Youtube format: PT45S, PT23M45S, PT1H23M45S
 * @param duration {String}
 * @returns {Number}
 */
export function youtubeDurationToSeconds (duration) {
  let match = duration.match(/PT(\d+H)?(\d+M)?(\d+S)?/)

  match = match.slice(1).map(function (x) {
    if (x != null) {
      return x.replace(/\D/, '')
    }
  })

  const hours = (parseInt(match[0]) || 0)
  const minutes = (parseInt(match[1]) || 0)
  const seconds = (parseInt(match[2]) || 0)

  return hours * 3600 + minutes * 60 + seconds
}
