
Security News
TypeScript is Porting Its Compiler to Go for 10x Faster Builds
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
jsx-control
Advanced tools
A JSTransform that adds syntactical sugar that turns <If> and <For> elements into control statements.
<If condition={this.props.banner}>
<Banner />
</If>
turns into...
{function() {
if (this.props.banner) {
return (<Banner />)
}
}.call(this)}
The <If> body must return a single JSX root element. You can even nest!
<If condition={this.props.banner}>
<div className="banner">
<Banner />
<If condition={this.props.user && this.props.user.avatar}>
<Picture avatar={this.props.user.avatar} />
</If>
</div>
</If>
<For each="fruit" of={this.props.fruits}>
<li key={fruit}>{fruit}</li>
</For>
this becomes
this.props.fruits.map(function(fruit) { return (
<li key={fruit}>{fruit}</li>
)}, this)
npm install jsx-control
A visitorList is available through jsx-control/visitors
, which can be used in conjunction with JSTransform Loader.
Include 'jsx-control/browserify' in your transform
array
The transform can be added during the install function of node-jsx
var jsxControl = require('jsx-control');
require('node-jsx').install({
extension: '.jsx',
additionalTransform: function(src) {
return jsxControl(src);
}
});
to valtech-au/jsx-control-statements for the inspiration! This module is slightly different in that it eschews <Else> in favour of nested <Ifs>, as well as constructing the statements slightly differently.
FAQs
Neater control statements (if/for) for JSX
The npm package jsx-control receives a total of 0 weekly downloads. As such, jsx-control popularity was classified as not popular.
We found that jsx-control demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.