jsnox.js
function jsnox(React) {
    var client = function jsnoxClient(componentType, props, children) {
        // Special $renderIf prop allows you to conditionally render an element:
        //if (props && typeof props.$renderIf !== 'undefined') {
        if (props && typeof props === 'object' && props.hasOwnProperty('$renderIf')) {
            if (props.$renderIf) delete props.$renderIf     // Don't pass down to components
            else return null
        }

        // Handle case where an array of children is given as the second argument:
        if (Array.isArray(props) || typeof props !== 'object') {
            children = props
            props = null
        }

        // Handle case where props object (second arg) is omitted
        var arg2IsReactElement = props && React.isValidElement(props)

        var finalProps = props
        if (typeof componentType === 'string' || !componentType) {
            // Parse the provided string into a hash of props
            // If componentType is invalid (undefined, empty string, etc),
            // parseTagSpec should throw.
            var spec = parseTagSpec(componentType)
            componentType = spec.tagName
            finalProps = arg2IsReactElement ? spec.props : extend(spec.props, props)
        }

        // If more than three args are given, assume args 3..n are ReactElement
        // children. You can also pass an array of children as the 3rd argument,
        // but in that case each child should have a unique key to avoid warnings.
        var args = protoSlice.call(arguments)
        if (args.length > 3 || arg2IsReactElement) {
            args[0] = componentType
            if (arg2IsReactElement) {
                args.splice(1, 0, finalProps || null)
            } else {
                args[1] = finalProps
            }
            return React.createElement.apply(React, args)
        } else {
            return React.createElement(componentType, finalProps, children)
        }
    }
    client.ParseError = ParseError
    return client
}
function jsnox(React) {
    var client = function jsnoxClient(componentType, props, children) {
        // Special $renderIf prop allows you to conditionally render an element:
        //if (props && typeof props.$renderIf !== 'undefined') {
        if (props && typeof props === 'object' && props.hasOwnProperty('$renderIf')) {
            if (props.$renderIf) delete props.$renderIf     // Don't pass down to components
            else return null
        }

        // Handle case where an array of children is given as the second argument:
        if (Array.isArray(props) || typeof props !== 'object') {
            children = props
            props = null
        }

        // Handle case where props object (second arg) is omitted
        var arg2IsReactElement = props && React.isValidElement(props)

        var finalProps = props
        if (typeof componentType === 'string' || !componentType) {
            // Parse the provided string into a hash of props
            // If componentType is invalid (undefined, empty string, etc),
            // parseTagSpec should throw.
            var spec = parseTagSpec(componentType)
            componentType = spec.tagName
            finalProps = arg2IsReactElement ? spec.props : extend(spec.props, props)
        }

        // If more than three args are given, assume args 3..n are ReactElement
        // children. You can also pass an array of children as the 3rd argument,
        // but in that case each child should have a unique key to avoid warnings.
        var args = protoSlice.call(arguments)
        if (args.length > 3 || arg2IsReactElement) {
            args[0] = componentType
            if (arg2IsReactElement) {
                args.splice(1, 0, finalProps || null)
            } else {
                args[1] = finalProps
            }
            return React.createElement.apply(React, args)
        } else {
            return React.createElement(componentType, finalProps, children)
        }
    }
    client.ParseError = ParseError
    return client
}
function jsnox ( React ) { var client = function jsnoxClient ( componentType , props , children ) { // Special $renderIf prop allows you to conditionally render an element: //if (props && typeof props.$renderIf !== 'undefined') { if ( props && typeof props === 'object' && props . hasOwnProperty ( '$renderIf' ) ) { if ( props . $renderIf ) delete props . $renderIf // Don't pass down to components else return null } // Handle case where an array of children is given as the second argument: if ( Array . isArray ( props ) || typeof props !== 'object' ) { children = props props = null } // Handle case where props object (second arg) is omitted var arg2IsReactElement = props && React . isValidElement ( props ) var finalProps = props if ( typeof componentType === 'string' || ! componentType ) { // Parse the provided string into a hash of props // If componentType is invalid (undefined, empty string, etc), // parseTagSpec should throw. var spec = parseTagSpec ( componentType ) componentType = spec . tagName finalProps = arg2IsReactElement ? spec . props : extend ( spec . props , props ) } // If more than three args are given, assume args 3..n are ReactElement // children. You can also pass an array of children as the 3rd argument, // but in that case each child should have a unique key to avoid warnings. var args = protoSlice . call ( arguments ) if ( args . length > 3 || arg2IsReactElement ) { args [ 0 ] = componentType if ( arg2IsReactElement ) { args . splice ( 1 , 0 , finalProps || null ) } else { args [ 1 ] = finalProps } return React . createElement . apply ( React , args ) } else { return React . createElement ( componentType , finalProps , children ) } } client . ParseError = ParseError return client }
Main exported function. Returns a "client", which is a function that can be used to compose ReactElement trees directly.
Main exported function . Returns a client which is a function that can be used to compose ReactElement trees directly .