Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

classcat

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

classcat

Build a class attribute string quickly.

  • 5.0.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is classcat?

The classcat npm package is a utility for conditionally combining class names. It is useful in scenarios where you need to dynamically apply multiple class names based on certain conditions, making it particularly handy in React and other component-based frameworks.

What are classcat's main functionalities?

Combining Class Names

This feature allows you to combine multiple class names into a single string. It is useful when you have a list of class names that you want to apply to an element.

const cc = require('classcat');
const className = cc(['class1', 'class2']);
console.log(className); // Output: 'class1 class2'

Conditional Class Names

This feature allows you to conditionally apply class names based on boolean values. Only the class names with a true value will be included in the final string.

const cc = require('classcat');
const className = cc({ 'class1': true, 'class2': false });
console.log(className); // Output: 'class1'

Nested Arrays

This feature supports nested arrays and objects, allowing for more complex class name combinations. It will recursively process the nested structures to generate the final class name string.

const cc = require('classcat');
const className = cc(['class1', ['class2', { 'class3': true }]]);
console.log(className); // Output: 'class1 class2 class3'

Other packages similar to classcat

Keywords

FAQs

Package last updated on 02 Apr 2024

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc