src/get-glamor-classname.js
function extractGlamorStyles(className) {
  const glamorlessClassName = []
  const glamorStyles = []
  className
    .toString()
    .split(' ')
    .forEach(name => {
      if (styleSheet.registered[name.substring(4)] === undefined) {
        glamorlessClassName.push(name)
      } else {
        const style = buildGlamorSrcFromClassName(name)
        glamorStyles.push(style)
      }
    })

  return {glamorlessClassName, glamorStyles}
}
function extractGlamorStyles(className) {
  const glamorlessClassName = []
  const glamorStyles = []
  className
    .toString()
    .split(' ')
    .forEach(name => {
      if (styleSheet.registered[name.substring(4)] === undefined) {
        glamorlessClassName.push(name)
      } else {
        const style = buildGlamorSrcFromClassName(name)
        glamorStyles.push(style)
      }
    })

  return {glamorlessClassName, glamorStyles}
}
function extractGlamorStyles ( className ) { const glamorlessClassName = [ ] const glamorStyles = [ ] className . toString ( ) . split ( ' ' ) . forEach ( name => { if ( styleSheet . registered [ name . substring ( 4 ) ] === undefined ) { glamorlessClassName . push ( name ) } else { const style = buildGlamorSrcFromClassName ( name ) glamorStyles . push ( style ) } } ) return { glamorlessClassName , glamorStyles } }
This function takes a className string and gets all the
associated glamor styles. It's used to merge glamor styles
from a className to make sure that specificity is not
a problem when passing a className to a component.
@param {String} [className=''] the className string
@return {Object} { glamorStyles, glamorlessClassName }
- glamorStyles is an array of all the glamor styles objects
- glamorlessClassName is the rest of the className string
without the glamor classNames
This function takes a className string and gets all the associated glamor styles . It s used to merge glamor styles from a className to make sure that specificity is not a problem when passing a className to a component .