Strict API for Hyperscript Libraries
As propsed in hyperhype/hyperscript#66 (comment), we implement the API
that is equivalent to
Due to the strict nature of the API,
the implementation code for the extension of h
is very short:
var isObject = val => (null != val) && ('object' == typeof val)
var extend = h => (obj, ...rest) => isObject(obj)
? h(obj.tag, obj.props, obj.children.map(child => isObject(child)
? extend(h)(child)
: child
))
: h(obj, ...rest)
module.exports = extend
git clone https://github.com/dmitriz/hyperscript-strict
yarn
npm test