function amfXDecode(rules, buffer) {
  // We shall receive clean buffer and will respond with an array of values
  let resp = [];
  let res;
  for (let i = 0; i < buffer.length;) {
    res = amfXDecodeOne(rules, buffer.slice(i));
    i += res.len;
    resp.push(res.value); // Add the response
  }
  return resp;
}
Decode a whole buffer of AMF values according to rules and return in array
@param {Array} rules
@param {Buffer} buffer
@returns {Array}