src/lib/entity.js
function getFromAttribute(component, propertyName, source) {
  var value;
  var mappings = source.mappings || {};
  var route = component.name + '.' + propertyName;
  var primitiveAttribute = findAttribute(mappings, route);
  if (primitiveAttribute && source.hasAttribute(primitiveAttribute)) {
    value = source.getAttribute(primitiveAttribute);
  }
  return value;

  function findAttribute(mappings, route) {
    var attributes = Object.keys(mappings);
    for (var i = 0, l = attributes.length; i < l; i++) {
      var attribute = attributes[i];
      if (mappings[attribute] === route) {
        return attribute;
      }
    }
    return undefined;
  }
}
function getFromAttribute(component, propertyName, source) {
  var value;
  var mappings = source.mappings || {};
  var route = component.name + '.' + propertyName;
  var primitiveAttribute = findAttribute(mappings, route);
  if (primitiveAttribute && source.hasAttribute(primitiveAttribute)) {
    value = source.getAttribute(primitiveAttribute);
  }
  return value;

  function findAttribute(mappings, route) {
    var attributes = Object.keys(mappings);
    for (var i = 0, l = attributes.length; i < l; i++) {
      var attribute = attributes[i];
      if (mappings[attribute] === route) {
        return attribute;
      }
    }
    return undefined;
  }
}
function getFromAttribute ( component , propertyName , source ) { var value ; var mappings = source . mappings || { } ; var route = component . name + '.' + propertyName ; var primitiveAttribute = findAttribute ( mappings , route ) ; if ( primitiveAttribute && source . hasAttribute ( primitiveAttribute ) ) { value = source . getAttribute ( primitiveAttribute ) ; } return value ; function findAttribute ( mappings , route ) { var attributes = Object . keys ( mappings ) ; for ( var i = 0 , l = attributes . length ; i < l ; i ++ ) { var attribute = attributes [ i ] ; if ( mappings [ attribute ] === route ) { return attribute ; } } return undefined ; } }
Gets the value for the component's property coming from a primitive
attribute.

Primitives have mappings from attributes to component's properties.
The function looks for a present attribute in the source element which
maps to the specified component's property.

@param  {Component} component    Component to be found.
@param  {string}    propertyName Component's property to be found.
@param  {Element}   source       Element owning the component.
@return {any}                    The value of the component's property coming
from the primitive's attribute if any or
`undefined`, otherwise.
Gets the value for the component s property coming from a primitive attribute .