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

fuzzy-rucksack

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fuzzy-rucksack

tools for fuzzy-chainsaw

  • 1.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5
Maintainers
1
Weekly downloads
 
Created
Source

fuzzy-rucksack

Some tools to help on your fuzzy-chainsaw adventures.

Install

npm install fuzzy-rucksack --save-dev

Documentation

createVariants(prefix, variants)

Creates an array of classNames from a space seperated variants string.

Example

createVariants('box--', 'round large dark');

/* output */
['box--round', 'box--large', 'box--dark']

createClassName(classNameArray)

Creates a className string based on input arrays. skips undefined values and flattens array entries.

Example

createClassName([
	'box',
	['box--round', 'box--large'],
	props.isActive ? 'box--is-active' : undefined,
	props.className
]);

/* props */
{ isActive: true, className: 'js-extra' }

/* output */
'box box--round box--large box--is-active js-extra'

PropTypes.variants(variantArray)

Validates that all variants in a space seperated string are valid.

Useage

const Button = ({ variant }) => (
	<div className={createVariants('box--', variant)} />
);

Button.propTypes = {
	variant: PropTypes.variants(['round', 'large', 'dark'])
}

/* valid */
<Button variant="round" />
<Button variant="large dark" />

/* invalid */
<Button variant="utlra" />
<Button variant="big dark" />
<Button variant="round ultra dark" />

License

MIT Copyright ConnectiveDX 2016

FAQs

Package last updated on 11 Apr 2017

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