You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found an inconsistency in the behaviour or Rantly(number) { ... }.
The documentation said:
Rantly(5) { integer } # same as Rantly.map(5) { integer }
=> [-1843396915550491870, -1683855015308353854, -2291347782549033959, -951461511269053584, 483265231542292652]
So I expect Rantly(number) { ... } to always return an array, however Rantly(0) { ... } and Rantly(1) { ... } will only return the element and not wrapped in an array.
Rantly.map() would be a best practice if you always expect Array return values. The Rantly.value() method can be used to return the single value when that's what you expect.
Note: Rantly {} can be useful when it's clear what you're returning and you prefer the terseness:
Hi Rantly team,
I found an inconsistency in the behaviour or
Rantly(number) { ... }
.The documentation said:
So I expect
Rantly(number) { ... }
to always return an array, howeverRantly(0) { ... }
andRantly(1) { ... }
will only return the element and not wrapped in an array.Please refer to this console output:
I found that the
Rantly.map(number) { ... }
is more consistent.Thanks.
The text was updated successfully, but these errors were encountered: