function parseFolderItems(items) {
  const readItems = items.filter((item) => !!item);
  const folders = readItems.filter((item) => item.stats.isDirectory()).map((item) => path.join(item.folderPath, item.itemName));
  const files = readItems.filter((item) => item.stats.isFile()).map(parseFile);
  const { videos, other } = sortFiles(files);

  return bluebird
    .map(folders, scanFolder)
    .each((sortedFiles) => {
      videos.push(...sortedFiles.videos);
      other.push(...sortedFiles.other);
    })
    .then(() => ({
      videos,
      other
    }));
}
/**
 * Parses folder contents. Subfolder contents are merged into results.
 * @param  {Array} items List of items inside the folder.
 * @return {Object}      Object containing videos and other files.
 */
Parses folder contents. Subfolder contents are merged into results.
@param  {Array} items List of items inside the folder.
@return {Object}      Object containing videos and other files.
Parses folder contents . Subfolder contents are merged into results . @param { Array } items List of items inside the folder . @return { Object } Object containing videos and other files .
function parseFolderItems(items) {
  const readItems = items.filter((item) => !!item);
  const folders = readItems.filter((item) => item.stats.isDirectory()).map((item) => path.join(item.folderPath, item.itemName));
  const files = readItems.filter((item) => item.stats.isFile()).map(parseFile);
  const { videos, other } = sortFiles(files);
  return bluebird
    .map(folders, scanFolder)
    .each((sortedFiles) => {
      videos.push(...sortedFiles.videos);
      other.push(...sortedFiles.other);
    })
    .then(() => ({
      videos,
      other
    }));
}
function parseFolderItems ( items ) { const readItems = items . filter ( ( item ) => ! ! item ) ; const folders = readItems . filter ( ( item ) => item . stats . isDirectory ( ) ) . map ( ( item ) => path . join ( item . folderPath , item . itemName ) ) ; const files = readItems . filter ( ( item ) => item . stats . isFile ( ) ) . map ( parseFile ) ; const { videos , other } = sortFiles ( files ) ; return bluebird . map ( folders , scanFolder ) . each ( ( sortedFiles ) => { videos . push ( ... sortedFiles . videos ) ; other . push ( ... sortedFiles . other ) ; } ) . then ( ( ) => ( { videos , other } ) ) ; }
Parses folder contents.
Parses folder contents .