function getObjects(data) {
  const objects = [];
  let currentObject = null;
  for (const item of data) {
    if (item instanceof Buffer) {
      if (currentObject) {
        currentObject.items.push(item);
      }
    } else if (typeof item === 'string') {
      if (/^\d+\s0\sobj/.test(item)) {
        currentObject = { items: [] };
        objects.push(currentObject);
      } else if (item === 'endobj') {
        currentObject = null;
      } else if (currentObject) {
        currentObject.items.push(item);
      }
    }
  }
  return objects;
}
@description
Returns an array of objects from the PDF data. Object items are surrounded by /\d 0 obj/ and 'endobj'.
@param {PDFData} data
@return {Array<PDFDataObject>}