igakim/mcs-ui

View on GitHub
src/utils.js

Summary

Maintainability
A
0 mins
Test Coverage
export const isEqualTypes = (type, compareType) => (
  type && type === compareType
);

export const getButtonType = type => (
  type && `mcs-button-${type}`
);

export const getClassNameFromArray = classesList => classesList
  .filter(el => (el !== undefined && el !== null))
  .join('-');

export const isClassComponent = component => (!!(
  typeof component === 'function'
    && component.prototype
    && component.prototype.isReactComponent
));

export const isFunctionComponent = component => (!!((
  typeof component === 'function'
    && !(
      component.prototype
      && component.prototype.isReactComponent
    )
)));

export const isReactComponent = component => (!!((
  isClassComponent(component)
    || isFunctionComponent(component)
)));