export function bindPages()

in src/contentScripts/functions.ts [91:106]


export function bindPages(pages: string[]): Documents {
  return pages.reduce(
    (docs, page) => {
      let doc = docs[docs.length - 1];
      // Check the bytes to ensure the total is less than the upper boundary
      if (new Blob([doc]).size + new Blob([page]).size < DOC_BOUNDARY) {
        doc += page;
        docs[docs.length - 1] = doc;
        return docs;
      }
      docs.push(page);
      return docs;
    },
    [''] as Documents
  );
}