Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pushing numbers to array fails #32

Open
d-p-dev opened this issue Apr 9, 2020 · 0 comments
Open

Pushing numbers to array fails #32

d-p-dev opened this issue Apr 9, 2020 · 0 comments
Assignees

Comments

@d-p-dev
Copy link
Contributor

d-p-dev commented Apr 9, 2020

It is not possible to push numbers to an array. If we do so:

- var min = 1
- var max = 99
- var i = min
- var array = []
while i < max
 - array.push(i)
 - i++

We get the following error

executing "mixin_cart" at <$n>: wrong type for value; expected pugjs.Object; got int

This is of because Array.Push only takes an object as parameter, and those initialized numbers aren't really of pugjs.Object type at that time.

However if we have something like the following

- var object = {
 min: 1,
 max: 99
}
- var i = object.min
- var array = []
while i < object.max
 - array.push(i)
 - i++

It would work perfectly, because the type of object.min assigned to i, is a valid Object.

@bastianccm bastianccm self-assigned this May 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants