parcoursup/node_modules/riot/esm/core/create-children-components-object.js
lalBi94 7bc56c09b5 $
2023-03-05 13:23:23 +01:00

24 lines
763 B
JavaScript

/* Riot WIP, @license MIT */
import { callOrAssign, camelToDashCase } from '@riotjs/util';
import { createComponentFromWrapper } from './create-component-from-wrapper.js';
/**
* Create the subcomponents that can be included inside a tag in runtime
* @param {Object} components - components imported in runtime
* @returns {Object} all the components transformed into Riot.Component factory functions
*/
function createChildrenComponentsObject(components) {
if (components === void 0) {
components = {};
}
return Object.entries(callOrAssign(components)).reduce((acc, _ref) => {
let [key, value] = _ref;
acc[camelToDashCase(key)] = createComponentFromWrapper(value);
return acc;
}, {});
}
export { createChildrenComponentsObject };