Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

to-class

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

to-class

Build a string of conditional, deduplicated classNames.

latest
Source
npmnpm
Version
1.4.1
Version published
Maintainers
1
Created
Source

to-class

Build status Coverage npm version Donate

Builds a string of conditional, deduplicated classNames using whatever you can throw at it.

# npm
npm install to-class

# yarn
yarn add to-class

Usage

import toClass from 'to-class';

toClass('foo', 'bar', 'foo'); // => 'foo bar'
toClass(['foo', 'bar', false]); // => 'foo bar'
toClass('foo', {bar: true}); // => 'foo bar'
toClass({foo: true}, {bar: true}); // => 'foo bar'
toClass({foo: true, bar: false}); // => 'foo'
toClass({foo: true, bar: true}, ['bar', 'baz', ['foo']], 'foo'); // => 'foo bar baz'

Polyfill

If you need to support browsers <= IE11 you can import the polyfilled version.

import toClass from 'to-class/polyfill';

FAQs

Package last updated on 28 Jul 2020

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