Skip to content
This repository was archived by the owner on Jul 30, 2024. It is now read-only.

Commit ca8bb1d

Browse files
committed
Can be passed to foreach
1 parent 549d959 commit ca8bb1d

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

app/nodejs-v10/src/test/scala/io/scalajs/nodejs/console_module/ConsoleTest.scala

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,16 @@ class ConsoleTest extends AnyFunSpec with BeforeAndAfterEach {
4040
Console.trace("", 6)
4141
}
4242

43+
it("should be passed to foreach") {
44+
val s: Seq[js.Any] = Seq("s", true)
45+
s.foreach(Console.log)
46+
s.foreach(Console.info)
47+
s.foreach(Console.warn)
48+
s.foreach(Console.debug)
49+
s.foreach(Console.error)
50+
s.foreach(Console.trace)
51+
}
52+
4353
it("have table added in v10.0.0") {
4454
Console.table(js.Array("x", "y"))
4555
}

app/nodejs-v14/src/main/scala/io/scalajs/nodejs/console_module/Console.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ class Console protected () extends js.Object {
8080
* @param args
8181
*/
8282
def debug(args: js.Any*): Unit = js.native
83+
def debug(arg: js.Any): Unit = js.native
8384

8485
/**
8586
* Uses [[io.scalajs.nodejs.util.Util.inspect()]] on `obj` and prints the resulting string to `stdout`.
@@ -106,6 +107,7 @@ class Console protected () extends js.Object {
106107
* @param args
107108
*/
108109
def error(args: js.Any*): Unit = js.native
110+
def error(arg: js.Any): Unit = js.native
109111

110112
/**
111113
* Increases indentation of subsequent lines by two spaces.
@@ -131,13 +133,15 @@ class Console protected () extends js.Object {
131133
* The `console.info()` function is an alias for [[log()]].
132134
*/
133135
def info(args: js.Any*): Unit = js.native
136+
def info(arg: js.Any): Unit = js.native
134137

135138
/**
136139
* Prints to `stdout` with newline.
137140
* Multiple arguments can be passed, with the first used as the primary message and all additional used as
138141
* substitution values similar to `printf(3)` (the arguments are all passed to `util.format()`).
139142
*/
140143
def log(args: js.Any*): Unit = js.native
144+
def log(arg: js.Any): Unit = js.native
141145

142146
/**
143147
* Try to construct a table with the columns of the properties of `tabularData` (or use `properties`) and
@@ -175,11 +179,13 @@ class Console protected () extends js.Object {
175179
* message and stack trace to the current position in the code.
176180
*/
177181
def trace(args: js.Any*): Unit = js.native
182+
def trace(arg: js.Any): Unit = js.native
178183

179184
/**
180185
* The `console.warn()` function is an alias for [[error()]
181186
*/
182187
def warn(args: js.Any*): Unit = js.native
188+
def warn(arg: js.Any): Unit = js.native
183189

184190
/**
185191
* This method does not display anything unless used in the inspector.

0 commit comments

Comments
 (0)