Injects given field values at each field of given string
@param  {String}   string
@param  {String[]} attributes
@return {FieldString}
963108
function injectFields(string, values) {
	const fieldsModel = parseFields(string);
	const fieldsAmount = fieldsModel.fields.length;

	if (fieldsAmount) {
		values = values.slice();
		if (values.length > fieldsAmount) {
			// More values that output fields: collapse rest values into
			// a single token
			values = values.slice(0, fieldsAmount - 1)
				.concat(values.slice(fieldsAmount - 1).join(', '));
		}

		while (values.length) {
			const value = values.shift();
			const field = fieldsModel.fields.shift();
			const delta = value.length - field.length;

			fieldsModel.string = fieldsModel.string.slice(0, field.location)
				+ value
				+ fieldsModel.string.slice(field.location + field.length);

			// Update location of the rest fields in string
			for (let i = 0, il = fieldsModel.fields.length; i < il; i++) {
				fieldsModel.fields[i].location += delta;
			}
		}
	}

	return fieldsModel;
}
476258
def _insert_attributes(attrs, order=[])
      return if attrs.nil?
      order.each do |k|
        v = attrs[k]
        @target << %{ #{k}=#{@quote}#{_attr_value(v)}#{@quote}} if v
      end
      attrs.each do |k, v|
        @target << %{ #{k}=#{@quote}#{_attr_value(v)}#{@quote}} unless order.member?(k) # " WART
      end
    end
82099
function attrFactory (attrs) {
  let directAttrs = []
  let includeAttrs = []

  attrs.forEach(attr => {
    if (_.isString(attr) && attr.startsWith('include.')) {
      includeAttrs.push(attr.replace('include.', ''))
    } else {
      directAttrs.push(attr)
    }
  })

  if (directAttrs.includes('$all')) {
    if (directAttrs.length !== 1) {
      this.options.attributes = {include: []}
      directAttrs.filter(attr => attr !== '$all').forEach(attr => {
        this.options.attributes.include.push(attr)
      })
    }
  } else if (directAttrs.includes('$exclude')) {
    this.options.attributes = {exclude: directAttrs.filter(attr => attr !== '$exclude')}
  } else {
    this.options.attributes = directAttrs
  }

  includeAttrs.forEach(i => {
    nestHandler.call(this, this.options.include, i)
  })
}
274459
def attributes= (attrs)
      attrs.each_pair do |name, value|
        field = schema.fields[name.to_s] || FieldDefinition.new(name, :type => value.class)
        setter = "#{name}=".to_sym
        if respond_to?(setter)
          send(setter, value)
        else
          write_attribute(field, value, self)
        end
      end
    end
435921
public void insertAttributeValueString(String attributeName, String value, int index) {

        m_entity.insertAttributeValue(attributeName, value, index);
    }
1191774
function serializeStringFields(fields) {
  let length = 0;
  fields.forEach((field) => {
    length += (field.length + 4);
  });
  let buffer = new Buffer(4 + length);
  let offset = base_serializers.uint32(length, buffer, 0);

  fields.forEach((field) => {
    offset = base_serializers.string(field, buffer, offset);
  });
  return buffer;
}
1055732
function node(name, attributes) {
    "use strict";
    var _node   = document.createElementNS('', name);
    for (var attrName in attributes) {
        var value = attributes[attrName];
        if (attributes.hasOwnProperty(attrName) && isString(attrName)) {
            _node.setAttribute(attrName, value);
        }
    }
    return _node;
}
199850
function(attr) {
        var html = this._escapedAttributes[attr];
        if (html) {
          return html;
        }
        var val = this.attributes[attr];
        var escaped;
        if (isNullOrUndefined(val)) {
          escaped = '';
        } else {
          escaped = _.escape(val.toString());
        }
        this._escapedAttributes[attr] = escaped;
        return escaped;
      }
138863
public void addAttributes(final Map<String, Object> attributes) {
        if (attributes != null) {
            for (final Map.Entry<String, Object> entry : attributes.entrySet()) {
                addAttribute(entry.getKey(), entry.getValue());
            }
        }
    }
341265
function attributes(node) {
    var obj = {};
    each(function(attr) {
      obj[attr.name] = attr.value;
    }, node.attributes);
    return obj;
  }
1019092
function getDataAttributes(attributes) {
  if (!attributes) {
    return {};
  }

  return Object.keys(attributes).reduce((ret, key) => {
    ret[`data-${key.toLowerCase()}`] = attributes[key];
    return ret;
  }, {});
}
660979
function (params) {

            var attrs;
            if ('object' == typeof params) {
                attrs = params;
            }
            if ('string' == typeof params) {
                if (arguments.length > 1) {
                    attrs = {};
                    attrs[params] = arguments[1];
                }else{
                    return getElAttributes(this[0],params);
                }
            }
            if (attrs) {
                this.each(function (inx, ele) {
                    setAttributes(ele, attrs);
                });
            }
        }
330243
public ThingAttribute withAttributes(java.util.Map<String, String> attributes) {
        setAttributes(attributes);
        return this;
    }
1371779
function(attributes_object) {

		var name,
			result = '';

		for (name in attributes_object) {

			result += ' ' + name + '="' + Firestorm.String.escape(attributes_object[name], Firestorm.String.ATTRIBUTE_ESCAPE_REGEX) + '"';

		}

		return result;

	}
804441
function getAttributes(obj) {
    let attrString = '';
    let attrArray = Object.keys(obj);
    for (let tag of attrArray) {
        if (tag != ATTR && ATTRTAG.test(tag)) {
            attrString += ` ${tag.replace('_', '')}="${obj[tag]}"`;
        }
    }
    if (ATTR in obj) {
        attrString += ' ' + obj[ATTR];
    }
    return attrString;
}
397236
function attributesToString(obj, prevObj, level) {
            var attrs = '',
                prefix,
                tab;
            level = level || 1;
            tab = getTabs(level, true);
            _.forEach(obj, function (v, k) {
                if(excludeAttrs.indexOf(k) === -1){
                    var prev = prevObj && prevObj[k] !== undefined ? prevObj[k] : undefined;
                    prefix = attrs.length ? ',\n' : '';
                    if(_.isPlainObject(v)){
                        var subAttr = attributesToString(v, prev, level +1);
                        if(subAttr && subAttr.length)
                            attrs += (prefix + tab + k + ': {\n' + subAttr + '\n' + tab + '}');
                    } else {
                        if(prev !== v){
                            var val = k === 'type' ? 'types.' + v : v;
                            if(_.isArray(val))
                                val = arrayToString(val);
                            if(_.isFunction(val)){
                                val = funcToString(val.toString(), 2);
                            }
                            attrs += (prefix + tab + k + ': ' + val);
                        }
                    }
                }
            });

            return attrs;
        }
373989
function(fields, data) {
    if (!_.isString(fields)) {
      return data;
    }

    // If a field is specified as `foo.bar` or `foo.bar.baz`,
    // Convert it to just `foo`
    var map = {};
    _.forEach(fields.split(','), function(field) {
      map[field.split('.')[0]] = 1;
    });

    var keys = _.keys(map);
    if (_.isArray(data)) {
      data = _.map(data, function(object) {
        return _.pick(object, keys);
      });
    } else if (_.isObject(data)) {
      data = _.pick(data, keys);
    }

    return data;
  }