Skip to content

Pushing numbers to array fails #32

@d-p-dev

Description

@d-p-dev

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions