diff options
Diffstat (limited to 'lib/system')
-rw-r--r-- | lib/system/jssys.nim | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/system/jssys.nim b/lib/system/jssys.nim index 3908fb3d9..b9b0fe586 100644 --- a/lib/system/jssys.nim +++ b/lib/system/jssys.nim @@ -758,13 +758,13 @@ else: # Workaround for IE, IE up to version 11 lacks 'Math.trunc'. We produce # 'Math.trunc' for Nim's ``div`` and ``mod`` operators: -when not defined(nodejs): - {.emit: """ - if (!Math.trunc) { - Math.trunc = function(v) { - v = +v; - if (!isFinite(v)) return v; - - return (v - v % 1) || (v < 0 ? -0 : v === 0 ? v : 0); - }; - }""".} +const jsMathTrunc = """ +if (!Math.trunc) { + Math.trunc = function(v) { + v = +v; + if (!isFinite(v)) return v; + return (v - v % 1) || (v < 0 ? -0 : v === 0 ? v : 0); + }; +} +""" +when not defined(nodejs): {.emit: jsMathTrunc .} |