File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
packages/babel-plugin-htm Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -71,6 +71,8 @@ export default function htmBabelPlugin({ types: t }, options = {}) {
7171 }
7272
7373 function propsNode ( props ) {
74+ if ( props == null ) return t . nullLiteral ( ) ;
75+
7476 return t . isNode ( props ) ? props : t . objectExpression (
7577 Object . keys ( props ) . map ( key => {
7678 let value = props [ key ] ;
@@ -85,7 +87,11 @@ export default function htmBabelPlugin({ types: t }, options = {}) {
8587 ) ;
8688 }
8789
88- function transform ( { tag, props, children } , state ) {
90+ function transform ( node , state ) {
91+ if ( node === undefined ) return t . identifier ( 'undefined' ) ;
92+ if ( node == null ) return t . nullLiteral ( ) ;
93+
94+ const { tag, props, children } = node ;
8995 function childMapper ( child ) {
9096 if ( typeof child === 'string' ) {
9197 return stringValue ( child ) ;
You can’t perform that action at this time.
0 commit comments