function assertDependencies (name, dependencies, scope) {
  const allDefined = dependencies
    .filter(dependency => !isOptionalDependency(dependency)) // filter optionals
    .every(dependency => scope[dependency] !== undefined)

  if (!allDefined) {
    const missingDependencies = dependencies.filter(dependency => scope[dependency] === undefined)

    // TODO: create a custom error class for this, a MathjsError or something like that
    throw new Error(`Cannot create function "${name}", ` +
      `some dependencies are missing: ${missingDependencies.map(d => `"${d}"`).join(', ')}.`)
  }
}
Assert that all dependencies of a list with dependencies are available in the provided scope.

Will throw an exception when there are dependencies missing.

@param {string} name   Name for the function to be created. Used to generate a useful error message
@param {string[]} dependencies
@param {Object} scope