lib/functions/component.js
function component(color, name) {
  utils.assertColor(color, 'color');
  utils.assertString(name, 'name');
  var name = name.string
    , unit = unitMap[name]
    , type = typeMap[name]
    , name = componentMap[name];
  if (!name) throw new Error('invalid color component "' + name + '"');
  return new nodes.Unit(color[type][name], unit);
}
function component(color, name) {
  utils.assertColor(color, 'color');
  utils.assertString(name, 'name');
  var name = name.string
    , unit = unitMap[name]
    , type = typeMap[name]
    , name = componentMap[name];
  if (!name) throw new Error('invalid color component "' + name + '"');
  return new nodes.Unit(color[type][name], unit);
}
function component ( color , name ) { utils . assertColor ( color , 'color' ) ; utils . assertString ( name , 'name' ) ; var name = name . string , unit = unitMap [ name ] , type = typeMap [ name ] , name = componentMap [ name ] ; if ( ! name ) throw new Error ( 'invalid color component "' + name + '"' ) ; return new nodes . Unit ( color [ type ] [ name ] , unit ) ; }
Return component `name` for the given `color`.

@param {RGBA|HSLA} color
@param {String} name
@return {Unit}
@api public
Return component name for the given color .