Fix replacement of numbers 0 and 1 in permutations

In permutations the code replaces boolean
values with their javascript string counterparts.
This fix prevents replacing 0 and 1 (typeof int)
as they are interpreted as boolean values if not
explicietly checked.