Commit 192d003a authored by Regis's avatar Regis

add comment about complex regex in pagination

parent 22ddaa5e
......@@ -27,6 +27,8 @@
const { totalPages, nextPage, previousPage } = this.pageInfo;
if (text === SPREAD) return;
// the regex here is to read if the string coming in will become a valid string
// had issues with parsing using `+` because `typeof NaN === 'number'`
if (/^-?[\d.]+(?:e-?\d+)?$/.test(text)) pagenum = +text;
if (text === LAST) pagenum = totalPages;
if (text === NEXT) pagenum = nextPage;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment