libs/populateMap.js
function validateNode (cost) {
  cost = Number(cost)

  if (isNaN(cost)) {
    throw new TypeError(`Cost must be a number, istead got ${cost}`)
  }

  if (cost <= 0) {
    throw new TypeError(`The cost must be a number above 0, instead got ${cost}`)
  }

  return cost
}
function validateNode (cost) {
  cost = Number(cost)

  if (isNaN(cost)) {
    throw new TypeError(`Cost must be a number, istead got ${cost}`)
  }

  if (cost <= 0) {
    throw new TypeError(`The cost must be a number above 0, instead got ${cost}`)
  }

  return cost
}
function validateNode ( cost ) { cost = Number ( cost ) if ( isNaN ( cost ) ) { throw new TypeError ( ` ${ cost } ` ) } if ( cost <= 0 ) { throw new TypeError ( ` ${ cost } ` ) } return cost }
Assert that the provided cost in a positive number

@private
@param {number} cost   Cost to validate
@return {number} cost
Assert that the provided cost in a positive number