Files
sgauthier 6e64e138e2
All checks were successful
Publish To Prod / deploy_and_publish (push) Successful in 35s
planning
2024-10-14 09:15:30 +02:00

28 lines
480 B
JavaScript

'use strict'
var assign = require('object-assign')
module.exports = u
function u(type, props, value) {
var node
if (
(value === null || value === undefined) &&
(typeof props !== 'object' || Array.isArray(props))
) {
value = props
props = {}
}
node = assign({type: String(type)}, props)
if (Array.isArray(value)) {
node.children = value
} else if (value !== null && value !== undefined) {
node.value = String(value)
}
return node
}