All Projects → jorgebucaran → Classcat

jorgebucaran / Classcat

Licence: mit
Build a class attribute string quickly.

Programming Languages

javascript
184084 projects - #8 most used programming language

Labels

Projects that are alternatives of or similar to Classcat

reducer-class
Boilerplate free class-based reducer creator. Built with TypeScript. Works with Redux and NGRX. Has integration with immer.
Stars: ✭ 25 (-97%)
Mutual labels:  class
PHP-Light-SQL-Parser
This class can parse SQL to get query type, tables, field values, etc.. It takes an string with a SQL statements and parses it to extract its different components. Currently the class can extract the SQL query method, the names of the tables involved in the query and the field values that are passed as parameters. This parser is pretty light re…
Stars: ✭ 23 (-97.24%)
Mutual labels:  class
Kotlin Result
A multiplatform Result monad for modelling success or failure operations.
Stars: ✭ 369 (-55.65%)
Mutual labels:  class
babel-plugin-private-underscores
Make _classMembers 'private' using symbols
Stars: ✭ 39 (-95.31%)
Mutual labels:  class
toxic-decorators
Library of Javascript decorators
Stars: ✭ 26 (-96.87%)
Mutual labels:  class
angular-ecmascript
Build an AngularJS app using ES6's class system
Stars: ✭ 28 (-96.63%)
Mutual labels:  class
JavaResolver
Java class file inspection library for .NET.
Stars: ✭ 39 (-95.31%)
Mutual labels:  class
Unifi Api Client
A PHP API client class to interact with Ubiquiti's UniFi Controller API
Stars: ✭ 602 (-27.64%)
Mutual labels:  class
BashClass
BashClass is an Object Oriented Programming language that compiles to BASH 4.4
Stars: ✭ 40 (-95.19%)
Mutual labels:  class
Ping
A PHP class to ping hosts.
Stars: ✭ 351 (-57.81%)
Mutual labels:  class
LMPHP
Multi-language management and support on the site.
Stars: ✭ 19 (-97.72%)
Mutual labels:  class
simplevk
SimpleVK это PHP библиотека для быстрой разработки ботов для VK | vk api php class bot sdk library client framework longpoll callback streaming auth
Stars: ✭ 84 (-89.9%)
Mutual labels:  class
Php Curl Class
PHP Curl Class makes it easy to send HTTP requests and integrate with web APIs
Stars: ✭ 2,903 (+248.92%)
Mutual labels:  class
Overview
Overview and map of the organization, for the UCSD course COGS108: Data Science in Practice.
Stars: ✭ 111 (-86.66%)
Mutual labels:  class
Jvm
🤗 JVM 底层原理最全知识总结
Stars: ✭ 7,756 (+832.21%)
Mutual labels:  class
python-autoclass
A python 3 library providing functions and decorators to automatically generate class code, such as constructor body or properties getters/setters along with optional support of validation contracts on the generated setters. Its objective is to reduce the amount of copy/paste code in your classes - and hence to help reducing human mistakes :).
Stars: ✭ 30 (-96.39%)
Mutual labels:  class
macro
Customize code using closures
Stars: ✭ 135 (-83.77%)
Mutual labels:  class
Reclass.net
More than a ReClass port to the .NET platform.
Stars: ✭ 766 (-7.93%)
Mutual labels:  class
Coolie
Coolie(苦力) helps you to create models (& their constructors) from a JSON file.
Stars: ✭ 508 (-38.94%)
Mutual labels:  class
Stampit
OOP is better with stamps: Composable object factories.
Stars: ✭ 3,021 (+263.1%)
Mutual labels:  class

Classcat

Build a class attribute string quickly.

  • Framework agnostic, reusable, plain vanilla JavaScript.
  • Up to 2.5x faster than alternatives.
  • 217 B (minified+gzipped). 👌

This module makes it easy to build a space-delimited class attribute string from an object or array of CSS class names. Just pair each class with a boolean value to add or remove them conditionally.

import cc from "classcat"

export const ToggleButton = ({ isOn, toggle }) => (
  <div className="btn" onClick={() => toggle(!isOn)}>
    <div
      className={cc({
        circle: true,
        off: !isOn,
        on: isOn,
      })}
    />
    <span className={cc({ textOff: !isOn })}>{isOn ? "ON" : "OFF"}</span>
  </div>
)

Try with React, lit-html, Mithril, Superfine

Installation

npm install classcat

Or without a build step—import it right in your browser.

<script type="module">
  import cc from "https://unpkg.com/classcat"
</script>

API

cc(names)

cc(names: string | number | object | array): string
import cc from "classcat"

cc("elf") //=> "elf"

cc(["elf", "orc", "gnome"]) //=> "elf orc gnome"

cc({
  elf: false,
  orc: null,
  gnome: undefined,
}) //=> ""

cc({
  elf: true,
  orc: false,
  gnome: true,
}) //=> "elf gnome"

cc([
  {
    elf: true,
    orc: false,
  },
  "gnome",
]) //=> "elf gnome"

Benchmarks

npm --prefix bench start

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].