module React module DOM $$.React.DOM.each do |name, factory| define_method(name) do |props = nil, children = nil, &block| if children.nil? if `Array.isArray(props)` children = props props = nil elsif !props.nil? && `typeof props !== 'object'` children = [props] props = nil end end `return factory(#{React.fix_props(props)}, #{children.to_n});` end end end end