UNPKG

435 BJavaScriptView Raw
1'use strict'
2
3var formatChildren = require('./base-format-children')
4
5function applyChildren (element, children) {
6 if (process.env.NODE_ENV !== 'production' && !element.flags) {
7 throw new Error(JSON.stringify(element) + ' is not a valid element')
8 }
9 if (children) {
10 element.children = children.length === 1 ? children[0] : children
11 }
12 return element
13}
14
15exports.formatChildren = formatChildren.bind(null, applyChildren)