imports/vx/client/code/ux.js
/**
     * Augment React children by recursively cloning and adding new properties.
     *
     * @param {array} children Array of children.
     * @param {function} predicate Predicate to test child for eligibility.
     * @param {object} properties Properties to be added to eligible child.
     * @return {array} Cloned children bearing new properties.
     */
Augment React children by recursively cloning and adding new properties.
@param {array} children Array of children.
@param {function} predicate Predicate to test child for eligibility.
@param {object} properties Properties to be added to eligible child.
@return {array} Cloned children bearing new properties.
Augment React children by recursively cloning and adding new properties . @param { array } children Array of children . @param { function } predicate Predicate to test child for eligibility . @param { object } properties Properties to be added to eligible child . @return { array } Cloned children bearing new properties .
augmentChildren(children, predicate, properties) {
        let newChildren = React.Children.map(children, child => {
            if (UX.isDOMTypeElement(child)) {
                return child
            }
            if (predicate(child)) {
                child = React.cloneElement(child, properties)
            }
            if (child.props.children) {
                let newChildren = UX.augmentChildren(child.props.children, predicate, properties)
                child = React.cloneElement(child, { children : newChildren })
            }
            return child
        })
        return newChildren
    }
augmentChildren ( children , predicate , properties ) { let newChildren = React . Children . map ( children , child => { if ( UX . isDOMTypeElement ( child ) ) { return child } if ( predicate ( child ) ) { child = React . cloneElement ( child , properties ) } if ( child . props . children ) { let newChildren = UX . augmentChildren ( child . props . children , predicate , properties ) child = React . cloneElement ( child , { children : newChildren } ) } return child } ) return newChildren }
Augment React children by recursively cloning and adding new properties.
Augment React children by recursively cloning and adding new properties .