
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
npm install jsxcond --save
_if (TEST_FORM, THEN_FORM, [ELSE_FORM])
import React from 'react';
import { _if } from 'jsxcond'
class SomeComponent extends React.Component {
render() {
const condition = true;
<div>
{_if ( condition, () => (
<span>
condition is true
</span>
), () => (
<span>
condition is false
</span>
))}
</div>
}
}
import React from 'react';
import { _if } from 'jsxcond'
class SomeComponent extends React.Component {
render() {
const condition = true;
<div>
{_if ( condition, () => (
<span>
condition is true
</span>
))}
</div>
}
}
TEST_FORM can be a functionimport React from 'react';
import { _if } from 'jsxcond'
class SomeComponent extends React.Component {
render() {
const condition = true;
<div>
{_if ( () => {
return true
}, () => (
<span>
condition is true
</span>
), () => (
<span>
condition is false
</span>
))}
</div>
}
}
() => () to have lazy eval(). However THEN_FORM and ELSE_FORM are still supported.import React from 'react';
import { _if } from 'jsxcond'
class SomeComponent extends React.Component {
render() {
const condition = true;
<div>
{_if ( condition, 'condition is true', (
<span>
condition is false
</span>
))}
</div>
}
}
_cond (STATEMENT1, STATEMENT2...)
STATEMENT can be array, function, common value:
When it is a value, it will be returned immediately.
When it is a function, it will be evaluated and returned immediately.
When it is a array, the first value will be used as TEST_FORM, and the second will be used as THEN_FORM.
Common Usage
import React from 'react';
import { _cond } from 'jsxcond'
class SomeComponent extends React.Component {
render() {
const condition = 3
<div>
{_cond (
[condition === 1, () => (
<span>
condition is 1
</span>
)],
[condition === 2 , () => (
<span>
condition is 2
</span>
)], () => (
<span>
Otherwise
</span>
)}
</div>
}
}
TEST_FORM can be a functionimport React from 'react';
import { _cond } from 'jsxcond'
class SomeComponent extends React.Component {
const condition = 3;
render() {
<div>
{_cond (
[
() => {
return condition === 1
}, () => (
<span> condition is 1 </span>
)
],
[
() => {
return condition === 2
}, () => (
<span> condition is 2 </span>
)
]
)}
</div>
}
}
MIT
FAQs
A simple lisp style if-else-then / cond utilify for react/jsx
The npm package jsxcond receives a total of 2 weekly downloads. As such, jsxcond popularity was classified as not popular.
We found that jsxcond 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.