# Modulus Calculation

I’m looking for a plug-in that will do modulus calculations. Here’s why:

1. I’m using an API from a site called Hunter that returns email addresses based on the domain that you pass it.
2. Hunter allows the return of the email addresses ten at a time. But, it will tell you how many email addresses there are for the domain. That number can be higher than ten. In that case, I have to call Hunter multiple times to get all of the email addresses.
3. For example, Hunter may have 73 email addresses for a domain. In order to get all 73 addresses, I need to call Hunter 8 times. The calls to Hunter have an offset parameter. The first call would have 0 as the offset (I’d get the first ten), the second call would have 10 for the offset (I’d get the second ten), the third would have 20 (I’d get the third 10), etc.
4. What I believe I need is a method to do Modulus math. With modulus math, I get the remainder of 73 divided by 10, which is 3. So I know I need to do 8 calls. If I had 70 email addresses the remainder would be 0. So I only have to do 7 calls.
5. There’s a round function in Math.js, but it doesn’t give the modulus. If I use Round, I’d get 70 for an input value of 73 rounded to 10. That means I’d only do 7 calls and miss the last 3 email addresses.

Does anyone know of a modulus calculator for Bubble?

I appreciate the help.

Greg

Hi!
I think you may overcomplicated this.
There’s already a modulo operator (will give 3)
You can also /10:ceiling (will give 8)
Editor example: https://bubble.io/page?type=page&name=test&id=sandboxjc&tab=tabs-1

2 Likes

Thanks! I searched the reference and users manual for “modulus”. Should have searched for “modulo”. You saved me a lot of time scratching my head.
Greg

1 Like