Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
Size: Mime:
// === poc probably remove ===

const directionMap = {
  top: '180deg',
  right: '-90deg',
  bottom: '',
  left: '90deg',
}

type DirectionOrRaw = 'top' | 'right' | 'bottom' | 'left' | string

function rotate(directionOrRaw: DirectionOrRaw): string {
  const degrees = directionMap[directionOrRaw]
  return `rotate(${degrees})`
}

export { directionMap, rotate }

// === registry ===

export const iconRegistry = {}
const isNotIndex = path => path.includes('index') === false
const toFolder = filename =>
  filename
    .split('/')
    .filter(isNotIndex)
    .pop()

// manually exported
export function loadIconRegistry() {
  // @todo need to ensure to not load the circular index
  // const requireIcons = require.context('./', true, /.*\/index.ts$/)
  // const setFolderNameOnIcons = filename => {
  //   const iconName = toFolder(filename)
  //   const Component = requireIcons(filename)
  //   iconRegistry[iconName] = Component.default
  // }
  // requireIcons.keys().forEach(setFolderNameOnIcons)
  // console.log('[icons]: ', iconRegistry)
  // return iconRegistry
}

let index = 0
export function fromPropsToIdentifier(props: any): string {
  index += 1
  const identifier =
    props.identifier ||
    props.className ||
    props.vectorClassName ||
    props.wording ||
    'EMPTY'

  return identifier + index
}