Skip to content

Commit 34668a9

Browse files
committed
Allow negative ids.
1 parent a0b1e1c commit 34668a9

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/pimscript.coffee

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,8 +315,11 @@ num2alphabet = (num) ->
315315
num = parseInt num
316316
if isNaN(num) or !isFinite(num)
317317
throw new Error "Invalid number"
318-
num = ""+num
319318
out = ""
319+
if num < 0
320+
num = 0 - num
321+
out += "X"
322+
num = ""+num
320323
for i in [0...num.length]
321324
out += chars[parseInt num.charAt(i)]
322325
return out

0 commit comments

Comments
 (0)