function assertDependencies(name, dependencies, scope) {
  var allDefined = dependencies.filter(function (dependency) {
    return !isOptionalDependency(dependency);
  }) // filter optionals
  .every(function (dependency) {
    return scope[dependency] !== undefined;
  });

  if (!allDefined) {
    var missingDependencies = dependencies.filter(function (dependency) {
      return scope[dependency] === undefined;
    }); // TODO: create a custom error class for this, a MathjsError or something like that

    throw new Error("Cannot create function \"".concat(name, "\", ") + "some dependencies are missing: ".concat(missingDependencies.map(function (d) {
      return "\"".concat(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
 */
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
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
function assertDependencies(name, dependencies, scope) {
  var allDefined = dependencies.filter(function (dependency) {
    return !isOptionalDependency(dependency);
  }) 
  .every(function (dependency) {
    return scope[dependency] !== undefined;
  });
  if (!allDefined) {
    var missingDependencies = dependencies.filter(function (dependency) {
      return scope[dependency] === undefined;
    }); 
    throw new Error("Cannot create function \"".concat(name, "\", ") + "some dependencies are missing: ".concat(missingDependencies.map(function (d) {
      return "\"".concat(d, "\"");
    }).join(', '), "."));
  }
}
function assertDependencies ( name , dependencies , scope ) { var allDefined = dependencies . filter ( function ( dependency ) { return ! isOptionalDependency ( dependency ) ; } ) . every ( function ( dependency ) { return scope [ dependency ] !== undefined ; } ) ; if ( ! allDefined ) { var missingDependencies = dependencies . filter ( function ( dependency ) { return scope [ dependency ] === undefined ; } ) ; throw new Error ( "Cannot create function \"" . concat ( name , "\", " ) + "some dependencies are missing: " . concat ( missingDependencies . map ( function ( d ) { return "\"" . concat ( d , "\"" ) ; } ) . join ( ', ' ) , "." ) ) ; } }
Assert that all dependencies of a list with dependencies are available in the provided scope.
Assert that all dependencies of a list with dependencies are available in the provided scope .
// filter optionals // TODO: create a custom error class for this, a MathjsError or something like that