
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
@xch/class-names
Advanced tools
Utility function for building className strings.
npm install --save @xch/class-names
import classNames from '@xch/class-names';
classNames('name1', 'name2'); // => 'name1 name2'
const someOptionalClassName = getOptionalClassName(); // Assume this returns `null` or `false`.
// Falsy inputs are ignored.
classNames('name1', someOptionalClassName, 'name2'); // => 'name1 name2'
// Also supports arrays.
classNames([ 'name1', someOptionalClassName, 'name2' ]); // => 'name1 name2'
// Object's own property names will be collected when their values are truthy.
const dynamicClassNames = {
foo: true,
bar: false,
// If property value is a function, its return value will be used.
baz: () => false,
qux: () => true,
// There is no nesting.
quux: {
foo: true,
},
};
classNames(dynamicClassNames); // => 'foo qux quux'
// Boolean values and numbers are ignored since they are meaningless.
classNames('name1', 123, true, 'name2'); // => 'name1 name2'
import React from 'react';
import ReactDOM from 'react-dom';
import classNames from '@xch/class-names';
const Component = (props) => {
return (
<div
className={classNames(
'module-name',
{
'module-name--disabled': props.disabled,
'module-name--highlighted': props.highlighted,
},
)}
>{props.children}</div>
);
};
ReactDOM.render(<Component disabled />, 'root'); // Element.className => 'module-name module-name--disabled'
MIT
FAQs
Utility function for building className strings
We found that @xch/class-names 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
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.