Latest Threat Research:Malicious dYdX Packages Published to npm and PyPI After Maintainer Compromise.Details
Socket
Book a DemoInstallSign in
Socket

jcls

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jcls

## Install

Source
npmnpm
Version
0.2.3
Version published
Weekly downloads
64
-56.76%
Maintainers
1
Weekly downloads
 
Created
Source

CSS class joiner/remover utility

Install

yarn add jcls
# or
npm install -S jcls
import jcls, {rcls} from 'jcls'
// or
const {default: jcls, rcls} = require('jcls')

API

Exported methods

export default function jcls(...classNames: readonly any[]): string;
export declare const rcls: (classNames: string, ...toRemove: readonly any[]) => string;
  • jcls(...classNames): Join classes into a single string.

    Falsy parameters are ignored. Other values are joined.

  • rcls(classNames, ...toRemove): remove classes from an existing class string.

toRemove can contain string, boolean, RegExp, or function. Falsy parameters from toRemove are ignored.

Sample usages

jcls(
	styles.container,
    isDisabled && styles.disabled,
    '', // ignored
)
jcls('mb-2 p-3', styles.button)
rcls('mb-2 p-3 flex', 'p-3', 'flex') // note: toRemove must include class name separatedly
rcls('mb-2 p-3 flex', /p-.*/, /p?-.*/)

Keywords

class

FAQs

Package last updated on 13 Mar 2023

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