Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
The fastest and tiniest utility for conditionally joining classNames.
npm install classix
Use any amount of string expressions and classix will join them like so:
import cx from "classix";
// or
import { cx } from "classix";
cx("class1", "class2");
// => "class1 class2"
cx("class1 class2", "class3", "class4 class5");
// => "class1 class2 class3 class4 class5"
cx("class1", true && "class2");
// => "class1 class2"
cx(false && "class1", "class2");
// => "class2"
cx(true ? "class1" : "class2");
// => "class1"
cx("class1", false ? "class2" : "class3");
// => "class1 class3"
cx(...["class1", "class2", "class3"]);
// => class1 class2 class3
cx(
"flex",
isPrimary ? "bg-primary-100" : "bg-secondary-100",
isLarge ? "m-4 p-4" : "m-2 py-2"
);
// => "flex bg-primary-100 m-2 p-2" *assuming isPrimary is true and isLarge is false
Sources: classix, clsx, classnames
Sources: Ran benchmark on an AMD Ryzen 5 5600x.
Compared to other libraries, classix simplifies its API by omitting the use of object arguments, which it considers less ergonomic than string expressions:
// 🚫
cx({ "class-1": isPrimary && isLarge, "class-2": !isPrimary || !isLarge });
// ✅
cx(isPrimary && isLarge ? "class-1" : "class-2");
For a list of changes and releases, see the changelog.
Found a bug, have a question or looking to improve classix? Open an issue, start a discussion or submit a PR!
FAQs
The fastest and tiniest utility for conditionally joining classNames.
The npm package classix receives a total of 4,891 weekly downloads. As such, classix popularity was classified as popular.
We found that classix demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.