summary refs log tree commit diff stats
path: root/lib/std/private
diff options
context:
space:
mode:
authorflywind <xzsflywind@gmail.com>2021-03-19 23:54:10 +0800
committerGitHub <noreply@github.com>2021-03-19 16:54:10 +0100
commite332c20ba7f0fffc0ad42751a99e11232973f27f (patch)
treeb57e29a8f4352ce1f655bc01066a5924673bf536 /lib/std/private
parent6c1c8f51b38c9bc570a70ec8d2836b823d3584cc (diff)
downloadNim-e332c20ba7f0fffc0ad42751a99e11232973f27f.tar.gz
follow up #17276 (#17355)
* improve test coverage for isolation

* a bit better

* rename channels to channels_builtin

* follow up #17276

* fix

* Update lib/std/private/jsutils.nim
Diffstat (limited to 'lib/std/private')
-rw-r--r--lib/std/private/jsutils.nim12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/std/private/jsutils.nim b/lib/std/private/jsutils.nim
index cf58b3b81..32c717c56 100644
--- a/lib/std/private/jsutils.nim
+++ b/lib/std/private/jsutils.nim
@@ -1,4 +1,4 @@
-when defined(js):
+when defined(js) or defined(nimdoc):
   import std/jsbigints
 
   type
@@ -40,4 +40,12 @@ when defined(js):
 
   proc isInteger*[T](x: T): bool {.importjs: "Number.isInteger(#)".}
 
-  proc isSafeInteger*[T](x: T): bool {.importjs: "Number.isSafeInteger(#)".}
+  proc isSafeInteger*[T](x: T): bool {.importjs: "Number.isSafeInteger(#)".} =
+    runnableExamples:
+      import std/jsffi
+      assert not "123".toJs.isSafeInteger
+      assert 123.toJs.isSafeInteger
+      assert 9007199254740991.toJs.isSafeInteger
+      assert not 9007199254740992.toJs.isSafeInteger
+
+  let maxSafeInteger* {.importjs: "Number.MAX_SAFE_INTEGER".} : int64
43e66596 ^
e9fc86597 ^
96c571dd9 ^
a01fd5e93 ^

c525dfabc ^

31a41594c ^
c1c3c4c5d ^
633dcca71 ^
5b9465acf ^

299b04491 ^
c1c76a20e ^
931496770 ^

ee08c6eec ^
c1c76a20e ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45