src/util/mixin.js
/**
 * Return a subclass factory function that mixins the resource factory
 * functions from all the entities provided.
 * This provides a way to extend a Scope class and add a mixin that contains
 * all the resource methods available for that scope.
 *
 * E.g.
 * ```
 *  class Operator extends OperatorAccess(Scope) {}
 * ```
 *
 * See: http://raganwald.com/2015/12/28/mixins-subclass-factories-and-method-advice.html#fn:simplified
 *
 * @param {Array} entities - List of entities to add resources to
 * @return {function(Scope)}
 */
Return a subclass factory function that mixins the resource factory
functions from all the entities provided.
This provides a way to extend a Scope class and add a mixin that contains
all the resource methods available for that scope.





@param {Array} entities - List of entities to add resources to
@return {function(Scope)}
Return a subclass factory function that mixins the resource factory functions from all the entities provided . This provides a way to extend a Scope class and add a mixin that contains all the resource methods available for that scope . @param { Array } entities - List of entities to add resources to @return { function ( Scope ) }
function mixinResources (entities) {
  const resourceFactories = entities.map((e) => e.resourceFactory())
  const accessResources = Object.assign({}, ...resourceFactories)
  return (Superclass) => mixin(accessResources)(class extends Superclass {})
}
function mixinResources ( entities ) { const resourceFactories = entities . map ( ( e ) => e . resourceFactory ( ) ) const accessResources = Object . assign ( { } , ... resourceFactories ) return ( Superclass ) => mixin ( accessResources ) ( class extends Superclass { } ) }
Return a subclass factory function that mixins the resource factory
 functions from all the entities provided.
Return a subclass factory function that mixins the resource factory functions from all the entities provided .