Set showFirstLast to false when pages of collection are less than X

If there is a collection returned using shopify instant search and pagination is being used how can one hide the first and last pagination tabs when there are only 1-3 pages for example.
This is how I’ve set up the pagination widget

instant.search.addWidget(
    instantsearch.widgets.pagination({
      container: '.ais-pagination-container-2',
      padding: 2,
      maxPages: 20
    })
  );

and I see one would set

showFirstLast: false

to hide the tabs but how can i do this on a case by case basis that if, for example.

if(nbPages < 4) { showFristLast: false }

how and where does one access nbPages in the widget?

Hi Jaime,

This does not appear to be possible out of the box. However, there is a discussion about it a few places with some mention of it being done.


Let me know how it goes and if you have any other questions.

Thanks!