Skip to content

Commit e8f4acd

Browse files
author
Lawrence Daniels
committed
Consolidating NodeJS current and LTS
1 parent b2e2973 commit e8f4acd

File tree

179 files changed

+8431
-32
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

179 files changed

+8431
-32
lines changed

.gitignore

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@
88
.history
99
.lib/
1010
dist/*
11-
project/target/*
12-
project/project/*
13-
target/*
11+
target/
1412
lib_managed/
1513
src_managed/
1614
project/boot/
@@ -20,7 +18,17 @@ project/plugins/project/
2018
.scala_dependencies
2119
.worksheet
2220

23-
#Intellij
24-
.idea
21+
# ENSIME specific
22+
.ensime_cache/
23+
.ensime
24+
### SBT template
25+
# Simple Build Tool
26+
# http://www.scala-sbt.org/release/docs/Getting-Started/Directories.html#configuring-version-control
27+
28+
target/
29+
lib_managed/
30+
src_managed/
31+
project/boot/
32+
.history
33+
.cache
2534

26-
1.txt
Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
package io.scalajs.nodejs
2+
3+
import io.scalajs.nodejs.events.IEventEmitter
4+
5+
import scala.scalajs.js
6+
import scala.scalajs.js.annotation.JSImport
7+
8+
/**
9+
* The assert module provides a simple set of assertion tests that can be used to test invariants. The module is
10+
* intended for internal use by Node.js, but can be used in application code via require('assert'). However, assert
11+
* is not a testing framework, and is not intended to be used as a general purpose assertion library.
12+
*
13+
* The API for the assert module is Locked. This means that there will be no additions or changes to any of the
14+
* methods implemented and exposed by the module.
15+
* @author lawrence.daniels@gmail.com
16+
*/
17+
@js.native
18+
trait Assert extends IEventEmitter {
19+
20+
/**
21+
* An alias of assert.ok() .
22+
* @param expression the expression to evaluate
23+
* @example assert(value[, message])
24+
*/
25+
def apply(expression: js.Any, message: String = js.native): Unit = js.native
26+
27+
/**
28+
* Tests for deep equality between the actual and expected parameters. Primitive values are compared with the equal
29+
* comparison operator ( == ). Only enumerable "own" properties are considered. The deepEqual() implementation does
30+
* not test object prototypes, attached symbols, or non-enumerable properties. This can lead to some potentially
31+
* surprising results.
32+
* @example assert.deepEqual(actual, expected[, message])
33+
*/
34+
def deepEqual(actual: js.Any, expected: js.Any, message: String = js.native): Unit = js.native
35+
36+
/**
37+
* Generally identical to assert.deepEqual() with two exceptions. First, primitive values are compared using the
38+
* strict equality operator ( === ). Second, object comparisons include a strict equality check of their prototypes.
39+
* @example assert.deepStrictEqual(actual, expected[, message])
40+
*/
41+
def deepStrictEqual(actual: js.Any, expected: js.Any, message: String): Unit = js.native
42+
43+
/**
44+
* Asserts that the function block does not throw an error. See assert.throws() for more details.
45+
* When assert.doesNotThrow() is called, it will immediately call the block function. If an error is thrown
46+
* and it is the same type as that specified by the error parameter, then an AssertionError is thrown. If the
47+
* error is of a different type, or if the error parameter is undefined, the error is propagated back to the caller.
48+
* @example assert.doesNotThrow(block[, error][, message])
49+
*/
50+
def doesNotThrow(block: js.Function, error: js.Any, message: String): Unit = js.native
51+
52+
/**
53+
* Asserts that the function block does not throw an error. See assert.throws() for more details.
54+
* When assert.doesNotThrow() is called, it will immediately call the block function. If an error is thrown
55+
* and it is the same type as that specified by the error parameter, then an AssertionError is thrown. If the
56+
* error is of a different type, or if the error parameter is undefined, the error is propagated back to the caller.
57+
* @example assert.doesNotThrow(block[, error][, message])
58+
*/
59+
def doesNotThrow(block: js.Function, message: String): Unit = js.native
60+
61+
/**
62+
* Asserts that the function block does not throw an error. See assert.throws() for more details.
63+
* When assert.doesNotThrow() is called, it will immediately call the block function. If an error is thrown
64+
* and it is the same type as that specified by the error parameter, then an AssertionError is thrown. If the
65+
* error is of a different type, or if the error parameter is undefined, the error is propagated back to the caller.
66+
* @example assert.doesNotThrow(block[, error][, message])
67+
*/
68+
def doesNotThrow(block: js.Function, error: js.Any = js.native): Unit = js.native
69+
70+
/**
71+
* Tests shallow, coercive equality between the actual and expected parameters using the equal comparison operator ( == ).
72+
* @example assert.equal(actual, expected[, message])
73+
*/
74+
def equal(actual: js.Any, expected: js.Any, message: String = js.native): Unit = js.native
75+
76+
/**
77+
* Throws an AssertionError. If message is falsy, the error message is set as the values of actual and expected
78+
* separated by the provided operator. Otherwise, the error message is the value of message.
79+
* @example assert.fail(actual, expected, message, operator)
80+
*/
81+
def fail(actual: js.Any, expected: js.Any, message: String, operator: String): Unit = js.native
82+
83+
/**
84+
* Throws value if value is truthy. This is useful when testing the error argument in callbacks.
85+
* @example assert.ifError(value)
86+
*/
87+
def ifError(value: js.Any): Unit = js.native
88+
89+
/**
90+
* Tests for any deep inequality. Opposite of assert.deepEqual().
91+
* @example assert.notDeepEqual(actual, expected[, message])
92+
*/
93+
def notDeepEqual(actual: js.Any, expected: js.Any, message: String = js.native): Unit = js.native
94+
95+
/**
96+
* Tests for deep strict inequality. Opposite of assert.deepStrictEqual().
97+
* @example assert.notDeepStrictEqual(actual, expected[, message])
98+
*/
99+
def notDeepStrictEqual(actual: js.Any, expected: js.Any, message: String = js.native): Unit = js.native
100+
101+
/**
102+
* Tests shallow, coercive inequality with the not equal comparison operator ( != ).
103+
* @example assert.notEqual(actual, expected[, message])
104+
*/
105+
def notEqual(actual: js.Any, expected: js.Any, message: String = js.native): Unit = js.native
106+
107+
/**
108+
* Tests strict inequality as determined by the strict not equal operator ( !== ).
109+
* @example assert.notStrictEqual(actual, expected[, message])
110+
*/
111+
def notStrictEqual(actual: js.Any, expected: js.Any, message: String = js.native): Unit = js.native
112+
113+
/**
114+
* Tests if value is truthy. It is equivalent to assert.equal(!!value, true, message). If value is not truthy,
115+
* an AssertionError is thrown with a message property set equal to the value of the message parameter. If the
116+
* message parameter is undefined, a default error message is assigned.
117+
*/
118+
def ok(value: js.Any, message: String = js.native): Unit = js.native
119+
120+
/**
121+
* Tests strict equality as determined by the strict equality operator ( === ).
122+
* @example assert.strictEqual(actual, expected[, message])
123+
*/
124+
def strictEqual(actual: js.Any, expected: js.Any, message: String = js.native): Unit = js.native
125+
126+
/**
127+
* If the values are not strictly equal, an AssertionError is thrown with a message property set equal to the value
128+
* of the message parameter. If the message parameter is undefined, a default error message is assigned.
129+
* @example assert.throws(block[, error][, message])
130+
*/
131+
def throws(block: js.Function, error: js.Any, message: String = js.native): Unit = js.native
132+
133+
}
134+
135+
/**
136+
* Assert Singleton
137+
* @author lawrence.daniels@gmail.com
138+
*/
139+
@js.native
140+
@JSImport("assert", JSImport.Namespace)
141+
object Assert extends Assert
Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
package io.scalajs.nodejs
2+
3+
import io.scalajs.nodejs.stream.Writable
4+
5+
import scala.scalajs.js
6+
import scala.scalajs.js.annotation.JSImport
7+
8+
/**
9+
* The console module provides a simple debugging console that is similar to the JavaScript console mechanism
10+
* provided by web browsers.
11+
*
12+
* The module exports two specific components:
13+
* <ul>
14+
* <li>A Console class with methods such as console.log(), console.error() and console.warn() that can be used to
15+
* write to any Node.js stream.</li>
16+
* <li>A global console instance configured to write to stdout and stderr. Because this object is global, it can be
17+
* used without calling require('console').</li>
18+
* </ul>
19+
* @see https://nodejs.org/dist/latest-v8.x/docs/api/console.html
20+
* @author lawrence.daniels@gmail.com
21+
*/
22+
@js.native
23+
@JSImport("console", "Console")
24+
class Console(stdout: Writable, stderr: Writable = js.native) extends js.Object {
25+
26+
/**
27+
* A simple assertion test that verifies whether value is truthy. If it is not, an AssertionError is thrown.
28+
* If provided, the error message is formatted using util.format() and used as the error message.
29+
* @example console.assert(value[, message][, ...])
30+
*/
31+
def assert(value: js.Any, message: String, args: Any*): Unit = js.native
32+
33+
/**
34+
* A simple assertion test that verifies whether value is truthy. If it is not, an AssertionError is thrown.
35+
* If provided, the error message is formatted using util.format() and used as the error message.
36+
* @example console.assert(value[, message][, ...])
37+
*/
38+
def assert(value: js.Any, args: Any*): Unit = js.native
39+
40+
/**
41+
* When stdout is a TTY, calling console.clear() will attempt to clear the TTY. When stdout is not a TTY,
42+
* this method does nothing.
43+
*
44+
* Note: The specific operation of console.clear() can vary across operating systems and terminal types.
45+
* For most Linux operating systems, console.clear() operates similarly to the clear shell command.
46+
* On Windows, console.clear() will clear only the output in the current terminal viewport for the Node.js binary.
47+
*/
48+
def clear(): Unit = js.native
49+
50+
/**
51+
* Maintains an internal counter specific to label and outputs to stdout the number of times console.count() has been called with the given label.
52+
* @param label the display label for the counter. Defaults to 'default'.
53+
*/
54+
def count(label: String = js.native): Unit = js.native
55+
56+
/**
57+
* Resets the internal counter specific to label.
58+
* @param label the display label for the counter. Defaults to 'default'.
59+
*/
60+
def countReset(label: String = js.native): Unit = js.native
61+
62+
/**
63+
* Uses util.inspect() on obj and prints the resulting string to stdout.
64+
* This function bypasses any custom inspect() function defined on obj
65+
* @example console.dir(obj[, options])
66+
*/
67+
def dir(obj: js.Any, options: ConsoleDirOptions): Unit = js.native
68+
69+
/**
70+
* Uses util.inspect() on obj and prints the resulting string to stdout.
71+
* This function bypasses any custom inspect() function defined on obj
72+
* @example console.dir(obj[, options])
73+
*/
74+
def dir(obj: js.Any): Unit = js.native
75+
76+
/**
77+
* Prints to stderr with newline. Multiple arguments can be passed, with the first used as the primary message and
78+
* all additional used as substitution values similar to printf(3) (the arguments are all passed to util.format()).
79+
* @param data the given data arguments
80+
* @example console.error([data][, ...])
81+
*/
82+
def error(data: js.Any, args: Any*): Unit = js.native
83+
84+
/**
85+
* Increases indentation of subsequent lines by two spaces.
86+
* If one or more labels are provided, those are printed first without the additional indentation.
87+
* @param label the labels
88+
*/
89+
def group(label: js.Any*): Unit = js.native
90+
91+
/**
92+
* An alias for console.group().
93+
*/
94+
def groupCollapsed(): Unit = js.native
95+
96+
/**
97+
* Decreases indentation of subsequent lines by two spaces.
98+
*/
99+
def groupEnd(): Unit = js.native
100+
101+
/**
102+
* The console.info() function is an alias for console.log().
103+
* @example console.info([data][, ...])
104+
*/
105+
def info(data: js.Any, args: Any*): Unit = js.native
106+
107+
/**
108+
* Prints to stdout with newline. Multiple arguments can be passed, with the first used as the primary message and
109+
* all additional used as substitution values similar to printf(3) (the arguments are all passed to util.format()).
110+
* @param data the given data arguments
111+
* @example console.log([data][, ...])
112+
*/
113+
def log(data: js.Any, args: Any*): Unit = js.native
114+
115+
/**
116+
* Starts a timer that can be used to compute the duration of an operation. Timers are identified by a unique label.
117+
* Use the same label when you call console.timeEnd() to stop the timer and output the elapsed time in milliseconds
118+
* to stdout. Timer durations are accurate to the sub-millisecond.
119+
* @example console.time(label)
120+
*/
121+
def time(label: String): Unit = js.native
122+
123+
/**
124+
* Stops a timer that was previously started by calling console.time() and prints the result to stdout
125+
* @example console.timeEnd(label)
126+
*/
127+
def timeEnd(label: String): Unit = js.native
128+
129+
/**
130+
* Prints to stderr the string 'Trace :', followed by the util.format() formatted message and stack trace to the
131+
* current position in the code.
132+
* @example console.trace(message[, ...])
133+
*/
134+
def trace(message: String, args: Any*): Unit = js.native
135+
136+
/**
137+
* Prints to stdout with newline. Multiple arguments can be passed, with the first used as the primary message and
138+
* all additional used as substitution values similar to printf(3) (the arguments are all passed to util.format()).
139+
* @param data the given data arguments
140+
* @example console.log([data][, ...])
141+
*/
142+
def warn(data: js.Any, args: Any*): Unit = js.native
143+
144+
}
145+
146+
/**
147+
* Console Dir Options
148+
* @param showHidden if true then the object's non-enumerable and symbol properties will be shown too. Defaults to false.
149+
* @param depth tells util.inspect() how many times to recurse while formatting the object. This is useful for
150+
* inspecting large complicated objects. Defaults to 2. To make it recurse indefinitely, pass null.
151+
* @param colors if true, then the output will be styled with ANSI color codes. Defaults to false. Colors are customizable;
152+
* see customizing util.inspect() colors.
153+
* @author lawrence.daniels@gmail.com
154+
*/
155+
class ConsoleDirOptions(var showHidden: js.UndefOr[Boolean] = js.undefined,
156+
var depth: js.UndefOr[Int] = js.undefined,
157+
var colors: js.UndefOr[Boolean] = js.undefined)
158+
extends js.Object

0 commit comments

Comments
 (0)