Created
December 30, 2016 08:03
-
-
Save barneycarroll/60c840306ed2d539444fd5864362ca83 to your computer and use it in GitHub Desktop.
Mithril patch which binds a `state.parent` property to nodes referring to the parent `vnode`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import m from 'mithril' | |
export default ( ...input ) => { | |
const parent = m( ...input ) | |
return ( | |
parent.children == undefined | |
? parent | |
: Object.assign( parent, { | |
children : children.map( child => Object.assign( child, { parent } ) ) | |
} ) | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment