UNPKG

@coorpacademy/progression-engine

Version:

26 lines (20 loc) 876 B
var _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; }; import { getConfig } from '../config'; import { computeInitialStep } from '../compute-next-step'; const createProgression = (engine, content, engineOptions, availableContent) => { const config = _extends({}, getConfig({ ref: engine.ref, version: 'latest' }), engineOptions); const initialAction = computeInitialStep(config, availableContent); if (!initialAction) { return null; } return { engine: _extends({}, engine, { version: config.version }), content, engineOptions, actions: [initialAction] }; }; export default createProgression; //# sourceMappingURL=index.js.map