============================================================================= Export functions =============================================================================
function fromMs (ms, format = 'mm:ss') {
  if (typeof ms !== 'number' || Number.isNaN(ms)) {
    throw new Error('NaN error')
  }

  let absMs = Math.abs(ms)

  let negative = (ms < 0)
  let hours = Math.floor(absMs / HOUR)
  let minutes = Math.floor(absMs % HOUR / MINUTE)
  let seconds = Math.floor(absMs % MINUTE / SECOND)
  let miliseconds = Math.floor(absMs % SECOND)

  return formatTime({
    negative, hours, minutes, seconds, miliseconds
  }, format)
}