@drawbotics/enums

0.2.0 • Public • Published

Enums

A small utility to create reliable enums.

Installation

$ npm i @drawbotics/enums

Usage

import Enum from '@drawbotics/enums';
import PropTypes from 'prop-types';


const Categories = new Enum('PRIMARY', 'SECONDARY');


const Button = ({ category, children }) => {
  return (
    <button className={category === Categories.PRIMARY ? 'primary' : 'secondary'}>
      {children}
    </button>
  );
};


Button.propTypes = {
  category: PropTypes.oneOf(Object.keys(Categories)),
};


export default Button;

Readme

Keywords

none

Package Sidebar

Install

npm i @drawbotics/enums

Weekly Downloads

0

Version

0.2.0

License

UNLICENSED

Unpacked Size

4.22 kB

Total Files

7

Last publish

Collaborators

  • manuelitox
  • larsbs
  • nicmosc
  • bartolomeumr
  • leopoldarkham