String to Number in View


#1

Hi. :wave:

I’m doing a pagination, and I need the page number to be converted to integer.

{
  "total": 8,
  "perPage": 2,
  "page": "2",
  "lastPage": 4

  ...
}

Note that above, the “page” property is a string.
So, when I do:

{{ data.page + 1 }}

It returns 11 (assuming that the current page is 1).

How can I do this?

Also check my other topic.


#2

See discussion here: https://github.com/adonisjs/adonis-lucid/issues/339


#3

Hi, thanks for the response.

But… This was not helpful to me since I am using MySQL.


#4

Then see https://github.com/mysqljs/mysql

Notably supportBigNumbers and bigNumberStrings config options.