All files set_progress.js

85.71% Statements 6/7
75% Branches 3/4
100% Functions 3/3
100% Lines 5/5
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19      2x 1x       2x   2x 2x              
import {isFunction} from 'lodash';
 
function getPercent(loaded, total, computable){
  if (!computable) return 100;
  return ((loaded / total) * 100);
}
 
export default function(progress){
  Iif (!isFunction(progress)) return;
 
  return function(loaded, total, lengthComputable){
    progress({
      percent: getPercent(loaded, total, lengthComputable)
      , loaded: loaded
      , total: total
    });
  };
};