babel-plugin-react-hyperscript
Advanced tools
Comparing version 0.0.2 to 0.0.3
@@ -114,11 +114,11 @@ 'use strict'; | ||
var dataSet = properties.properties.find(function (prop) { | ||
return prop.key.name === 'dataset' && t.isObjectExpression(prop.value); | ||
return prop.key && prop.key.name === 'dataset' && t.isObjectExpression(prop.value); | ||
}); | ||
var attributes = properties.properties.find(function (prop) { | ||
return prop.key.name === 'attributes' && t.isObjectExpression(prop.value); | ||
return prop.key && prop.key.name === 'attributes' && t.isObjectExpression(prop.value); | ||
}); | ||
var attrChildren = properties.properties.find(function (prop) { | ||
return prop.key.name === 'children' && t.isArrayExpression(prop.value); | ||
return prop.key && prop.key.name === 'children' && t.isArrayExpression(prop.value); | ||
}); | ||
@@ -138,3 +138,3 @@ | ||
properties.properties = properties.properties.filter(function (prop) { | ||
return prop.key.name !== 'dataset'; | ||
return !prop.key || prop.key.name !== 'dataset'; | ||
}); | ||
@@ -155,3 +155,3 @@ } | ||
properties.properties = properties.properties.filter(function (prop) { | ||
return prop.key.name !== 'attributes'; | ||
return !prop.key || prop.key.name !== 'attributes'; | ||
}); | ||
@@ -158,0 +158,0 @@ } |
{ | ||
"name": "babel-plugin-react-hyperscript", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "HyperScript syntax for React components without runtime overhead", | ||
@@ -26,2 +26,3 @@ "repository": "roman01la/babel-plugin-react-hyperscript", | ||
"babel-cli": "^6.24.1", | ||
"babel-plugin-transform-object-rest-spread": "^6.23.0", | ||
"babel-preset-es2015": "^6.24.1", | ||
@@ -28,0 +29,0 @@ "babylon": "^6.16.1", |
# babel-plugin-react-hyperscript | ||
*HyperScript components syntax for React without runtime overhead.* | ||
[![npm](https://img.shields.io/npm/v/babel-plugin-react-hyperscript.svg)](https://www.npmjs.com/package/babel-plugin-react-hyperscript) | ||
*HyperScript syntax for React components without runtime overhead.* | ||
Compiles [react-hyperscript](https://github.com/mlmorg/react-hyperscript) into `React.createElement`. | ||
@@ -45,2 +47,18 @@ | ||
```js | ||
// Input | ||
h('h1#boom.whatever.foo', [ | ||
h('span'), | ||
h(MyComponent, { text: 'Hello!' }) | ||
]); | ||
// Output | ||
yo('h1', { | ||
id: 'boom', | ||
className: 'whatever foo' | ||
}, | ||
yo('span'), | ||
yo(MyComponent, { text: 'Hello!' })); | ||
``` | ||
## Usage | ||
@@ -47,0 +65,0 @@ |
@@ -33,2 +33,5 @@ h('h1'); | ||
const obj = { a: 1 } | ||
h(Component, { ...obj, b: 2 }); | ||
h(Component); | ||
@@ -35,0 +38,0 @@ |
@@ -0,1 +1,3 @@ | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
React.createElement('h1'); | ||
@@ -37,2 +39,5 @@ | ||
const obj = { a: 1 }; | ||
React.createElement(Component, _extends({}, obj, { b: 2 })); | ||
React.createElement(Component); | ||
@@ -39,0 +44,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16697
346
88
5