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

Commit 0970cd1

Browse files
authored
Merge pull request #178 from exoego/naming
Naming all extension methods as ~Extensions
2 parents 70b640b + a4a1679 commit 0970cd1

File tree

15 files changed

+26
-24
lines changed

15 files changed

+26
-24
lines changed

app/current/src/main/scala/io/scalajs/nodejs/child_process/package.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ package object child_process {
1616
]
1717
type KillSignal = Int | String
1818

19-
implicit final class ChildProcessExtensions(private val cp: ChildProcess.type) extends AnyVal {
19+
implicit final class ChildProcessObjectExtensions(private val cp: ChildProcess.type) extends AnyVal {
2020
@inline
2121
def execFuture(
2222
command: String,
@@ -37,7 +37,7 @@ package object child_process {
3737
// TODO: spawn, fork
3838
}
3939

40-
implicit final class ChildProcessClassExtension(private val cp: ChildProcess) extends AnyVal {
40+
implicit final class ChildProcessExtensions(private val cp: ChildProcess) extends AnyVal {
4141
@inline
4242
def onClose(listener: (Int, String) => Any): ChildProcess = cp.on("close", listener)
4343

app/current/src/main/scala/io/scalajs/nodejs/cluster/package.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ package object cluster {
2020
* Cluster Events
2121
* @param cluster the given [[Cluster cluster]]
2222
*/
23-
implicit final class ClusterEvents(private val cluster: Cluster) extends AnyVal {
23+
implicit final class ClusterExtensions(private val cluster: Cluster) extends AnyVal {
2424

2525
/**
2626
* Emitted after the worker IPC channel has disconnected. This can occur when a worker exits gracefully, is killed,
@@ -105,7 +105,7 @@ package object cluster {
105105
* Worker Events and Extensions
106106
* @param worker the given [[Worker worker]]
107107
*/
108-
implicit final class WorkerEvents(private val worker: Worker) extends AnyVal {
108+
implicit final class WorkerExtensions(private val worker: Worker) extends AnyVal {
109109
/////////////////////////////////////////////////////////////////////////////////
110110
// Worker Extensions
111111
/////////////////////////////////////////////////////////////////////////////////

app/current/src/main/scala/io/scalajs/nodejs/dgram/package.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ package object dgram {
1212
type Message = BufferMessage | StringMessage
1313
type BufferMessage = Uint8Array | js.Array[Uint8Array]
1414

15-
implicit final class SocketExtension[T <: Socket](private val instance: T) extends AnyVal {
15+
implicit final class SocketExtensions[T <: Socket](private val instance: T) extends AnyVal {
1616
@enableIf(io.scalajs.nodejs.internal.CompilerSwitches.gteNodeJs12)
1717
@inline def onConnect(handler: () => Any): T = instance.on("connect", handler)
1818

app/current/src/main/scala/io/scalajs/nodejs/fs/ReadStream.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ object ReadStream {
5656
/**
5757
* Read Stream Events
5858
*/
59-
implicit final class ReadStreamExtension[R <: ReadStream](private val stream: R) extends AnyVal {
59+
implicit final class ReadStreamExtensions[R <: ReadStream](private val stream: R) extends AnyVal {
6060

6161
/**
6262
* Emitted when the ReadStream's underlying file descriptor has been closed using the fs.close() method.

app/current/src/main/scala/io/scalajs/nodejs/fs/WriteStream.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ object WriteStream {
5252
/**
5353
* Write Stream Events
5454
*/
55-
implicit final class WriteStreamExtension[T <: WriteStream](private val stream: T) extends AnyVal {
55+
implicit final class WriteStreamExtensions[T <: WriteStream](private val stream: T) extends AnyVal {
5656

5757
/**
5858
* Emitted when the WriteStream's underlying file descriptor has been closed using the fs.close() method.

app/current/src/main/scala/io/scalajs/nodejs/http/IncomingMessage.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ object IncomingMessage {
101101
/**
102102
* Incoming Message Extensions
103103
*/
104-
implicit final class IncomingMessageExtension[T <: IncomingMessage](private val message: T) extends AnyVal {
104+
implicit final class IncomingMessageExtensions[T <: IncomingMessage](private val message: T) extends AnyVal {
105105
@inline
106106
def onAborted(callback: () => Any): T = message.on("aborted", callback)
107107

app/current/src/main/scala/io/scalajs/nodejs/http/Server.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ object Server {
3232
* Server Events
3333
* @param server the given [[Server]]
3434
*/
35-
implicit final class ServerEvents[T <: Server](private val server: T) extends AnyVal {
35+
implicit final class ServerExtensions[T <: Server](private val server: T) extends AnyVal {
3636

3737
/**
3838
* Emitted each time a request with an HTTP Expect: 100-continue is received. If this event is not listened for,

app/current/src/main/scala/io/scalajs/nodejs/http2/package.scala

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ package object http2 {
1010
type Origin = String | URL | HasOrigin
1111
type Path = String | Buffer | URL
1212

13-
implicit final class Http2SessionExtension[T <: Http2Session](private val instance: T) extends AnyVal {
13+
implicit final class Http2SessionExtensions[T <: Http2Session](private val instance: T) extends AnyVal {
1414
@inline def onClose(handler: () => Any): T = instance.on("close", handler)
1515
@inline def onConnect(handler: (Http2Session, net.Socket) => Any): T = instance.on("connect", handler)
1616
@inline def onError(handler: (Error) => Any): T = instance.on("error", handler)
@@ -40,14 +40,14 @@ package object http2 {
4040
@inline def onWantTrailers(handler: () => Any): T = instance.on("wantTrailers", handler)
4141
}
4242

43-
implicit final class ClientHttp2StreamExtension[T <: ClientHttp2Stream](private val instance: T) extends AnyVal {
43+
implicit final class ClientHttp2StreamExtensions[T <: ClientHttp2Stream](private val instance: T) extends AnyVal {
4444
@inline def onContinue(handler: () => Any): T = instance.on("continue", handler)
4545
@inline def onHeaders(handler: (Http2Headers, Int) => Any): T = instance.on("headers", handler)
4646
@inline def onPush(handler: (Http2Headers, Int) => Any): T = instance.on("push", handler)
4747
@inline def onResponse(handler: (Http2Headers, Int) => Any): T = instance.on("response", handler)
4848
}
4949

50-
implicit final class Http2SeverExtension[T <: Http2Server](private val instance: T) extends AnyVal {
50+
implicit final class Http2SeverExtensions[T <: Http2Server](private val instance: T) extends AnyVal {
5151
@inline def onCheckContinue(handler: (Http2ServerRequest, Http2ServerResponse) => Any): T =
5252
instance.on("checkContinue", handler)
5353
@inline def onRequest(handler: (Http2ServerRequest, Http2ServerResponse) => Any): T =
@@ -59,7 +59,7 @@ package object http2 {
5959
@inline def onTimeout(handler: () => Any): T = instance.on("timeout", handler)
6060
}
6161

62-
implicit final class Http2SecureSeverExtension[T <: Http2SecureServer](private val instance: T) extends AnyVal {
62+
implicit final class Http2SecureSeverExtensions[T <: Http2SecureServer](private val instance: T) extends AnyVal {
6363
@inline def onCheckContinue(handler: (Http2ServerRequest, Http2ServerResponse) => Any): T =
6464
instance.on("checkContinue", handler)
6565
@inline def onRequest(handler: (Http2ServerRequest, Http2ServerResponse) => Any): T =
@@ -72,12 +72,12 @@ package object http2 {
7272
@inline def onUnknownProtocol(handler: () => Any): T = instance.on("unknownProtocol", handler)
7373
}
7474

75-
implicit final class Http2ServerRequestExtension[T <: Http2ServerRequest](private val instance: T) extends AnyVal {
75+
implicit final class Http2ServerRequestExtensions[T <: Http2ServerRequest](private val instance: T) extends AnyVal {
7676
@inline def onAborted(handler: (stream.IReadable) => Any): T = instance.on("aborted", handler)
7777
@inline def onClose(handler: () => Any): T = instance.on("close", handler)
7878
}
7979

80-
implicit final class Http2ServerResponseExtension[T <: Http2ServerResponse](private val instance: T) extends AnyVal {
80+
implicit final class Http2ServerResponseExtensions[T <: Http2ServerResponse](private val instance: T) extends AnyVal {
8181
@inline def onClose(handler: () => Any): T = instance.on("close", handler)
8282
@inline def onAborted(handler: (stream.IReadable) => Any): T = instance.on("aborted", handler)
8383
}

app/current/src/main/scala/io/scalajs/nodejs/readline/Interface.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ object Interface {
100100
* Readline Interface Events
101101
* @param readline the given [[Interface Readline Interface]]
102102
*/
103-
implicit final class InterfaceEvents[T <: Interface](private val readline: T) extends AnyVal {
103+
implicit final class InterfaceExtensions[T <: Interface](private val readline: T) extends AnyVal {
104104

105105
/**
106106
* Emitted when close() is called. Also emitted when the input stream receives its 'end' event.

app/current/src/main/scala/io/scalajs/nodejs/stream/Stream.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ object IWritable {
417417
/**
418418
* Writable Events
419419
*/
420-
implicit final class WritableExtension[W <: IWritable](private val writable: W) extends AnyVal {
420+
implicit final class WritableExtensions[W <: IWritable](private val writable: W) extends AnyVal {
421421

422422
/**
423423
* Emitted when the stream and any of its underlying resources (a file descriptor, for example) have been closed.

app/current/src/main/scala/io/scalajs/nodejs/stream/package.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ package object stream {
99
type ErrorCallback = js.Function1[io.scalajs.nodejs.Error, Any]
1010
type Wait = js.Function0[js.Promise[Unit]]
1111

12-
implicit final class StreamModuleExtension(private val stream: Stream.type) extends AnyVal {
12+
implicit final class StreamModuleExtensions(private val stream: Stream.type) extends AnyVal {
1313
def pipelineFromSeq(streams: Seq[Stream], errorCallback: ErrorCallback): Wait = {
1414
streams match {
1515
case Seq(a, b) => stream.pipeline(a, b, errorCallback)

app/current/src/main/scala/io/scalajs/nodejs/tls/package.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ package object tls {
1717
type ALPNProtocols =
1818
Buffer | TypedArray[_, _] | DataView | js.Array[String] | js.Array[TypedArray[_, _]] | js.Array[DataView]
1919

20-
implicit final class ServerExtension[T <: Server](private val instance: T) extends AnyVal {
20+
implicit final class ServerExtensions[T <: Server](private val instance: T) extends AnyVal {
2121
@enableIf(io.scalajs.nodejs.internal.CompilerSwitches.gteNodeJs12)
2222
@inline def onKeylog(handler: (Buffer, TLSSocket) => Any): T = instance.on("keylog", handler)
2323

@@ -31,7 +31,7 @@ package object tls {
3131
@inline def onTlsClientError(handler: (Error, tls.TLSSocket) => Any): T = instance.on("tlsClientError", handler)
3232
}
3333

34-
implicit final class TLSSocketExtension[T <: TLSSocket](private val instance: T) extends AnyVal {
34+
implicit final class TLSSocketExtensions[T <: TLSSocket](private val instance: T) extends AnyVal {
3535
@enableIf(io.scalajs.nodejs.internal.CompilerSwitches.gteNodeJs12)
3636
@inline def onKeylog(handler: (Buffer, TLSSocket) => Any): T = instance.on("keylog", handler)
3737

app/current/src/main/scala/io/scalajs/nodejs/tty/WriteStream.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ class WriteStream(fd: FileDescriptor) extends net.Socket {
2121
/**
2222
* A number specifying the number of columns the TTY currently has. This property is updated whenever
2323
* the 'resize' event is emitted.
24-
* @see [[WriteStreamEvents.onResize]]
24+
*
25+
* @see [[WriteStreamExtensions.onResize]]
2526
* @since 0.7.7
2627
*/
2728
def columns: Int = js.native
@@ -58,7 +59,8 @@ class WriteStream(fd: FileDescriptor) extends net.Socket {
5859
/**
5960
* A number specifying the number of rows the TTY currently has. This property is updated whenever the
6061
* 'resize' event is emitted.
61-
* @see [[WriteStreamEvents.onResize]]
62+
*
63+
* @see [[WriteStreamExtensions.onResize]]
6264
* @since 0.7.7
6365
*/
6466
def rows: Int = js.native

app/current/src/main/scala/io/scalajs/nodejs/tty/package.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ package object tty {
99
* Write Stream Events
1010
* @param stream the given [[WriteStream stream]]
1111
*/
12-
implicit final class WriteStreamEvents[W <: WriteStream](private val stream: W) extends AnyVal {
12+
implicit final class WriteStreamExtensions[W <: WriteStream](private val stream: W) extends AnyVal {
1313

1414
/**
1515
* The 'resize' event is emitted whenever either of the writeStream.columns or writeStream.rows properties have

app/current/src/main/scala/io/scalajs/util/NodeJSConverters.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import io.scalajs.nodejs.Error
55
import scala.scalajs.js
66

77
object NodeJSConverters {
8-
implicit final class ErrorExtension(val error: Error) extends AnyVal {
8+
implicit final class ErrorExtensions(val error: Error) extends AnyVal {
99
@inline
1010
def toException(): Exception = js.JavaScriptException(error.message)
1111
}

0 commit comments

Comments
 (0)