Created
October 17, 2015 17:40
-
-
Save natew/a23163d44b3971a63e6a to your computer and use it in GitHub Desktop.
This file contains 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
if (t.isArrayExpression(node.right)) { | |
let staticProps = [] | |
node.right.elements = node.right.elements.map(el => { | |
if (!t.isObjectExpression(el)) return el | |
let { statics, dynamics } = extractStatics(el) | |
if (statics.length) staticProps.push(statics) | |
if (dynamics.length) return t.objectExpression(dynamics) | |
else return null | |
}).filter(x => x !== null) | |
return [ | |
staticStatement(node, t.objectExpression(staticProps)), | |
dynamicStatement(node, node.right) | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment