24 lines
763 B
JavaScript
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 };
|