
Security News
Open Source Maintainers Feeling the Weight of the EU’s Cyber Resilience Act
The EU Cyber Resilience Act is prompting compliance requests that open source maintainers may not be obligated or equipped to handle.
one-spaces
Advanced tools
A tiny module for making className 😎
We are striving for the best performance and lightweight.
Please check our benchmark result!!!
npm install one-spaces
Please download this file.
And embed script tag in your document.
<script src="./dist/one-spaces.js"></script>
var el = document.getElementById("my-element");
// arguments
el.className = spaces("cls1", "cls2", "cls3");
// array
el.className = spaces(["cls1", "cls2"], ["cls3"]);
// exclude falsy
el.className = spaces(
"cls1",
null,
"cls2",
false && "none",
true && "cls3",
[]
);
// mix
el.className = spaces(["cls1", "cls2"], null, "cls3");
// without one-spaces
el.className = "cls1 cls2" + " cls3";
import React, { useState } from "react";
import spaces from "one-spaces";
import styles from "./Page.css";
export default () => {
const [isActive, setActive] = useState(false);
return (
<div className={styles.container}>
<span className={spaces(styles.text, isActive && styles.active)}>
Hello React!
</span>
<button onClick={() => setActive(!isActive)}>Toggle</button>
</div>
);
};
Angular and Vue have their own system for className.
Of course you can use this module with them but not recommended.
FAQs
A tiny module for making className 😎
The npm package one-spaces receives a total of 25 weekly downloads. As such, one-spaces popularity was classified as not popular.
We found that one-spaces 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 EU Cyber Resilience Act is prompting compliance requests that open source maintainers may not be obligated or equipped to handle.
Security News
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Research
/Security News
Undocumented protestware found in 28 npm packages disrupts UI for Russian-language users visiting Russian and Belarusian domains.