Pack data in the buffer
@function
@param {array} items
@return {string}
977469
function pack(items) {
		var data = arguments,
			idx = 0,
			buffer,
			bufferSize = 0;

		// Calculate buffer size
		items = items.split('');
		items.forEach(function(type) {
			if (type == 'v') {
				bufferSize += 2;
			} else if (type == 'V' || type == 'l') {
				bufferSize += 4;
			}
		});

		// Fill buffer
		buffer = new Buffer(bufferSize);
		items.forEach(function(type, index) {
			if (type == 'v') {
				buffer.writeUInt16LE(data[index + 1], idx);
				idx += 2;
			} else if (type == 'V') {
				buffer.writeUInt32LE(data[index + 1], idx);
				idx += 4;
			} else if (type == 'l') {
				buffer.writeInt32LE(data[index + 1], idx);
				idx += 4;
			}
		});

		return buffer;
	}
973195
function EventPacket(items) {
  Packet.call(this);
  this.items = items || [];
  this.json = JSON.stringify(this.items);
}
395626
function getRows (items) {
  const data = {}
  const rows = [[]]

  data.stacks = true

  for (var i = 0; i < items.length; i++) {
    const el = items[i]
    const dim = el.getBoundingClientRect()

    if (!dim.height) {
      continue
    }

    for (var j = rows.length - 1; j >= 0; j--) {
      const row = rows[j]

      if (!row[0]) {
        row.push(el)
        break
      }

      var leftDim = row[0].getBoundingClientRect()

      if (dim.top >= Math.floor(leftDim.bottom)) {
        rows.push([el])
        break
      }

      if (Math.floor(dim.bottom) > leftDim.top) {
        data.stacks = false

        if (dim.left < leftDim.left && !isRtl) {
          row.unshift(el)
          break
        }

        row.push(el)
        break
      }

      if (j === 0) {
        rows.unshift([el])
        break
      }
    }
  }

  data.rows = rows

  return data
}
519427
function getListItems(listKey, from, to, callback) {
	this.redisClient.lrange(listKey, from, to, function(err, itemBytesArray) {
		if (err) { return callback(err, null) }
		if (!itemBytesArray) { return callback(null, []) }
		for (var items=[], i=0; i<itemBytesArray.length; i++) {
			items.push(itemBytesArray[i].toString())
		}
		callback(null, items)
	})
}
1259249
def subpackets(*items):
    """"""
    prefixed = [subpacket_prefix_len(item) for item in items]
    return util.prefix_len('>H', b''.join(prefixed))
975216
function(items) {
            items = $.makeArray(items);

            for (var i = 0; i < items.length; i++) {
                var item = items[i];

                // Make sure we actually know about this item
                var index = $.inArray(item, this.$items);
                if (index !== -1) {
                    this._deinitItem(item);
                    this.$items.splice(index, 1);
                }
            }
        }
52677
function (items) {
        var self = this;

        self.items().set(self.create(items).concat(self.items().toArray()));

        return self.renderNew();
      }
312751
function () {
        const items = []
        _.each(this._items, (item) => {
          items.push(item.toObject())
        })
        return items
      }
1126139
function listAsArray(list){

   return foldR( function(arraySoFar, listItem){
      
      arraySoFar.unshift(listItem);
      return arraySoFar;
           
   }, [], list );
   
}
268249
function (data) {
        var items = [];
        data.forEach(function (d, i) {
            if (d.includes('ITEM:') && d.length > 3) {
                var iid = data[i + 1];
                var item = {
                    item: {
                        id: Number(iid[1].trim()),
                        name: d[2].replace(/_/g, ' '),
                        price: d[3],
                        change: d[4]
                    }
                };
                items.push(item);
            }
        });
        return items;
    }
1310856
def pack(data)
      values = []
      data.each do |k, v|
        values.push([k, v])
      end

      mapped_directives = @directives.map(&:name)

      values = values.select { |x| mapped_directives.include?(x[0]) }

      values.sort! do |a, b|
        mapped_directives.index(a[0]) <=> mapped_directives.index(b[0])
      end

      ary = values.map(&:last)
      ary.pack to_s(data)
    end
160655
function(items) {
            var str = [];
            for(var i=0; i<items.length; i++) {
                str.push('<option value="'+items[i][0]+'">'+items[i][1]+'</option>');                
            }
            return str.join("\n");
        }
811123
function(item){
    var children,node, nodes;
    if(!item) return;
    if(typeof item.node === "function") return item.node();
    if(typeof item.nodeType === "number") return item;
    if(item.group) return combine.node(item.group)

    item = item.children || item;
    if( Array.isArray(item )){
      var len = item.length;
      if(len === 1){
        return combine.node(item[0]);
      }
      nodes = [];
      for(var i = 0, len = item.length; i < len; i++ ){
        node = combine.node(item[i]);
        if(Array.isArray(node)){
          for (var j = 0, len1 = node.length; j < len1; j++){
            nodes.push(node[j])
          }
        }else if(node) {
          nodes.push(node)
        }
      }
      return nodes;
    }
    
  }
972989
function pack(id, type, body) {
    var buf = new Buffer(body.length + 14);
    buf.writeInt32LE(body.length + 10, 0);
    buf.writeInt32LE(id, 4);
    buf.writeInt32LE(type, 8);
    body.copy(buf, 12);
    buf[buf.length-2] = 0;
    buf[buf.length-1] = 0;
    return buf;
}
309379
function normalizeList(items) {
    if (!items) {
        return [];
    }
    var list;
    if (Array.isArray(items)) {
        list = [].concat(items);
    } else if (typeof items === 'string') {
        list = items.split(/[\s,]+/g).filter(Boolean);
    } else {
        throw new Error('Invalid items: ' + items);
    }
    return list;
}
938379
function constuctIdListString (items) {
  var idArr = []
  forEach(items, item => {
    idArr.push(item.getId())
  })
  idArr.sort()
  return idArr.join(',')
}
1129343
function readGetItemData(message, tokens) {
	message.itemNames = [];
	for (var i = 0; i < tokens.length; i = i + 2) {
		message.itemNames.push(protocol.decodeString(tokens[i + 1]));
	}
}