1 | import _find from "lodash/fp/find";
|
2 |
|
3 | function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
4 |
|
5 | import microlearning from './microlearning';
|
6 | import learner from './learner';
|
7 | import externalConfig from './external';
|
8 | const engineConfigurations = {
|
9 | microlearning,
|
10 | learner,
|
11 | external: externalConfig
|
12 | };
|
13 | export const getConfig = engine => {
|
14 | const engineConfiguration = engineConfigurations[engine.ref];
|
15 |
|
16 | if (!engineConfiguration) {
|
17 | throw new Error(`Unknown engine ${engine.ref}`);
|
18 | }
|
19 |
|
20 | return _find({
|
21 | version: engine.version
|
22 | }, engineConfiguration.configurations) || engineConfiguration.defaultConfiguration;
|
23 | };
|
24 | export const getConfigForProgression = progression => {
|
25 | return _extends(_extends({}, getConfig(progression.engine)), progression.engineOptions);
|
26 | };
|
27 |
|
\ | No newline at end of file |