New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@kifs-common/classnames

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@kifs-common/classnames

A reducer in a context

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

React-Context-Reducer

Release Minified Minified + zip Dependencies Tech Debt Maintainability

Lightweight – no dependencies – functions helper to handle classnames.

Install

  • npm i @kifs-common/classnames

Usage

import { join, } from '@kifs-common/classnames'

console.log(join())
// -> undefined

console.log(join('hello', 'world'))
// -> "hello world"

const hero = {
  firstname: 'Gerard',
  lastname: 'Pichon'
}
console.log(join(obj.firstname, obj.age, false, !obj.age && obj.lastname))
// -> "Gerard Pichon"

This is pretty usefull in a css-module context like:

import { join, } from '@kifs-common/classnames'

import style from 'style.css'

function createButton (color, disabled) {
  const button = document.createElement('button')
  button.className = join(style.button, style[color || 'primary'], disabled && style.disabled)
  return button
}

// Or JSX/react

function renderButton (color, disabled) {
  return (
    <button
      className={join(
        style.button,
        style[color || 'primary'],
        disabled && style.disabled
      )}>
    </button>
  )
}

Keywords

FAQs

Package last updated on 10 Nov 2021

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