Add new function number(n)

This commit is contained in:
alafr 2016-11-07 22:13:30 +02:00 committed by GitHub
parent 8b4f1536b5
commit d6b7fe88e4

View File

@ -129,7 +129,12 @@ class PDFDocument extends stream.Readable
@_offsets.push null # placeholder for this object's offset once it is finalized
@_waiting++
return ref
number: (n) ->
if n > -1e21 and n < 1e21
return Math.round(n * 1e6) / 1e6
throw new Error "unsupported number: #{n}"
_read: ->
# do nothing, but this method is required by node