Package: purescript-lua-integers
File: src/Data/Int.lua
Function: toStringAs
Class: show-escaping Severity: high
For non-decimal bases the digit alphabet is uppercase ("0123456789ABCDEF..."), so toStringAs hexadecimal 255 yields "FF" and toStringAs hexadecimal 2147483647 yields "7FFFFFFF". The upstream JS is i.toString(radix), which produces LOWERCASE digits. The package's own tests require lowercase: toStringAs hexadecimal 255 == "ff" and toStringAs hexadecimal 2147483647 == "7fffffff" (Test/Data/Int.purs lines 106, 109), and the round-trip doc example fromStringAs hexadecimal "ff" == Just 255 assumes lowercase. The uppercase output fails these assertions.
Current (Lua):
local digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
Expected: Lowercase alphanumeric digits matching JS Number.prototype.toString(radix), e.g. toStringAs hexadecimal 255 == "ff".
Proposed fix:
local digits = "0123456789abcdefghijklmnopqrstuvwxyz"
Found by the FFI audit; reproduced under Lua 5.1.
Package: purescript-lua-integers
File:
src/Data/Int.luaFunction:
toStringAsClass: show-escaping Severity: high
For non-decimal bases the digit alphabet is uppercase ("0123456789ABCDEF..."), so
toStringAs hexadecimal 255yields "FF" andtoStringAs hexadecimal 2147483647yields "7FFFFFFF". The upstream JS isi.toString(radix), which produces LOWERCASE digits. The package's own tests require lowercase:toStringAs hexadecimal 255 == "ff"andtoStringAs hexadecimal 2147483647 == "7fffffff"(Test/Data/Int.purs lines 106, 109), and the round-trip doc examplefromStringAs hexadecimal "ff" == Just 255assumes lowercase. The uppercase output fails these assertions.Current (Lua):
Expected: Lowercase alphanumeric digits matching JS Number.prototype.toString(radix), e.g. toStringAs hexadecimal 255 == "ff".
Proposed fix:
Found by the FFI audit; reproduced under Lua 5.1.