src/get-glamor-classname.js
function handleStyles(styles, props, context) {
  let current
  const mappedArgs = []
  const nonGlamorClassNames = []
  for (let i = 0; i < styles.length; i++) {
    current = styles[i]
    while (typeof current === 'function') {
      current = current(props, context)
    }
    if (typeof current === 'string') {
      const {glamorStyles, glamorlessClassName} = extractGlamorStyles(current)
      mappedArgs.push(...glamorStyles)
      nonGlamorClassNames.push(...glamorlessClassName)
    } else if (Array.isArray(current)) {
      const recursed = handleStyles(current, props, context)
      mappedArgs.push(...recursed.mappedArgs)
      nonGlamorClassNames.push(...recursed.nonGlamorClassNames)
    } else {
      mappedArgs.push(current)
    }
  }
  return {mappedArgs, nonGlamorClassNames}
}
function handleStyles(styles, props, context) {
  let current
  const mappedArgs = []
  const nonGlamorClassNames = []
  for (let i = 0; i < styles.length; i++) {
    current = styles[i]
    while (typeof current === 'function') {
      current = current(props, context)
    }
    if (typeof current === 'string') {
      const {glamorStyles, glamorlessClassName} = extractGlamorStyles(current)
      mappedArgs.push(...glamorStyles)
      nonGlamorClassNames.push(...glamorlessClassName)
    } else if (Array.isArray(current)) {
      const recursed = handleStyles(current, props, context)
      mappedArgs.push(...recursed.mappedArgs)
      nonGlamorClassNames.push(...recursed.nonGlamorClassNames)
    } else {
      mappedArgs.push(current)
    }
  }
  return {mappedArgs, nonGlamorClassNames}
}
function handleStyles ( styles , props , context ) { let current const mappedArgs = [ ] const nonGlamorClassNames = [ ] for ( let i = 0 ; i < styles . length ; i ++ ) { current = styles [ i ] while ( typeof current === 'function' ) { current = current ( props , context ) } if ( typeof current === 'string' ) { const { glamorStyles , glamorlessClassName } = extractGlamorStyles ( current ) mappedArgs . push ( ... glamorStyles ) nonGlamorClassNames . push ( ... glamorlessClassName ) } else if ( Array . isArray ( current ) ) { const recursed = handleStyles ( current , props , context ) mappedArgs . push ( ... recursed . mappedArgs ) nonGlamorClassNames . push ( ... recursed . nonGlamorClassNames ) } else { mappedArgs . push ( current ) } } return { mappedArgs , nonGlamorClassNames } }
this next function is on a "hot" code-path so it's pretty complex to make sure it's fast. eslint-disable-next-line complexity
this next function is on a hot code - path so it s pretty complex to make sure it s fast . eslint - disable - next - line complexity