Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: add added #4925

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 47 additions & 1 deletion doc/api/assert.markdown
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# Assert
<!-- YAML
added: v0.1.21
-->

Stability: 3 - Locked

Expand All @@ -12,7 +15,14 @@ The API for the `assert` module is [Locked][]. This means that there will be no
additions or changes to any of the methods implemented and exposed by
the module.

## assert(value[, message]), assert.ok(value[, message])
## assert(value[, message])
<!-- YAML
added: v0.5.9
-->
## assert.ok(value[, message])
<!-- YAML
added: v0.1.21
-->

Tests if `value` is truthy. It is equivalent to
`assert.equal(!!value, true, message)`.
Expand Down Expand Up @@ -44,6 +54,9 @@ assert.ok(false, 'it\'s false');
```

## assert.deepEqual(actual, expected[, message])
<!-- YAML
added: v0.1.21
-->

Tests for deep equality between the `actual` and `expected` parameters.
Primitive values are compared with the equal comparison operator ( `==` ).
Expand Down Expand Up @@ -102,6 +115,9 @@ property set equal to the value of the `message` parameter. If the `message`
parameter is undefined, a default error message is assigned.

## assert.deepStrictEqual(actual, expected[, message])
<!-- YAML
added: v1.2.0
-->

Generally identical to `assert.deepEqual` with the exception that primitive
values are compared using the strict equality operator ( `===` ).
Expand All @@ -122,6 +138,9 @@ property set equal to the value of the `message` parameter. If the `message`
parameter is undefined, a default error message is assigned.

## assert.doesNotThrow(block[, error][, message])
<!-- YAML
added: v0.1.21
-->

Asserts that the function `block` does not throw an error. See
[`assert.throws()`][] for more details.
Expand Down Expand Up @@ -174,6 +193,9 @@ assert.doesNotThrow(
```

## assert.equal(actual, expected[, message])
<!-- YAML
added: v0.1.21
-->

Tests shallow, coercive equality between the `actual` and `expected` parameters
using the equal comparison operator ( `==` ).
Expand All @@ -197,6 +219,9 @@ property set equal to the value of the `message` parameter. If the `message`
parameter is undefined, a default error message is assigned.

## assert.fail(actual, expected, message, operator)
<!-- YAML
added: v0.1.21
-->

Throws an `AssertionError`. If `message` is falsy, the error message is set as
the values of `actual` and `expected` separated by the provided `operator`.
Expand All @@ -213,6 +238,9 @@ assert.fail(1, 2, 'whoops', '>');
```

## assert.ifError(value)
<!-- YAML
added: v0.1.97
-->

Throws `value` if `value` is truthy. This is useful when testing the `error`
argument in callbacks.
Expand All @@ -227,6 +255,9 @@ assert.ifError(new Error()); // Throws Error
```

## assert.notDeepEqual(actual, expected[, message])
<!-- YAML
added: v0.1.21
-->

Tests for any deep inequality. Opposite of [`assert.deepEqual`][].

Expand Down Expand Up @@ -268,6 +299,9 @@ property set equal to the value of the `message` parameter. If the `message`
parameter is undefined, a default error message is assigned.

## assert.notDeepStrictEqual(actual, expected[, message])
<!-- YAML
added: v1.2.0
-->

Tests for deep strict inequality. Opposite of [`assert.deepStrictEqual`][].

Expand All @@ -286,6 +320,9 @@ with a `message` property set equal to the value of the `message` parameter. If
the `message` parameter is undefined, a default error message is assigned.

## assert.notEqual(actual, expected[, message])
<!-- YAML
added: v0.1.21
-->

Tests shallow, coercive inequality with the not equal comparison operator
( `!=` ).
Expand All @@ -308,6 +345,9 @@ property set equal to the value of the `message` parameter. If the `message`
parameter is undefined, a default error message is assigned.

## assert.notStrictEqual(actual, expected[, message])
<!-- YAML
added: v0.1.21
-->

Tests strict inequality as determined by the strict not equal operator
( `!==` ).
Expand All @@ -330,6 +370,9 @@ If the values are strictly equal, an `AssertionError` is thrown with a
`message` parameter is undefined, a default error message is assigned.

## assert.strictEqual(actual, expected[, message])
<!-- YAML
added: v0.1.21
-->

Tests strict equality as determined by the strict equality operator ( `===` ).

Expand All @@ -351,6 +394,9 @@ If the values are not strictly equal, an `AssertionError` is thrown with a
`message` parameter is undefined, a default error message is assigned.

## assert.throws(block[, error][, message])
<!-- YAML
added: v0.1.21
-->

Expects the function `block` to throw an error. If specified, `error` can be a
constructor, [`RegExp`][], or validation function.
Expand Down
18 changes: 18 additions & 0 deletions doc/api/repl.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,16 @@ and try to print `obj` in REPL, it will invoke the custom `inspect()` function:
```

## Class: REPLServer
<!-- YAML
added: v0.1.92
-->

This inherits from [Readline Interface][] with the following events:

### Event: 'exit'
<!-- YAML
added: v0.9.1
-->

`function () {}`

Expand All @@ -175,6 +181,9 @@ replServer.on('exit', () => {


### Event: 'reset'
<!-- YAML
added: v0.11.8
-->

`function (context) {}`

Expand All @@ -197,6 +206,9 @@ replServer.on('reset', (context) => {
```

### replServer.defineCommand(keyword, cmd)
<!-- YAML
added: v0.3.0
-->

* `keyword` {String}
* `cmd` {Object|Function}
Expand Down Expand Up @@ -235,6 +247,9 @@ Hello, Node.js User!
```

### replServer.displayPrompt([preserveCursor])
<!-- YAML
added: v0.1.92
-->

* `preserveCursor` {Boolean}

Expand All @@ -244,6 +259,9 @@ used primarily with `defineCommand`. It's also used internally to render each
prompt line.

## repl.start(options)
<!-- YAML
added: v0.1.92
-->

Returns and starts a `REPLServer` instance, that inherits from
[Readline Interface][]. Accepts an "options" Object that takes
Expand Down
27 changes: 27 additions & 0 deletions doc/api/timers.markdown
Original file line number Diff line number Diff line change
@@ -1,23 +1,38 @@
# Timers
<!-- YAML
added: v0.0.1
-->

Stability: 3 - Locked

All of the timer functions are globals. You do not need to `require()`
this module in order to use them.

## clearImmediate(immediateObject)
<!-- YAML
added: v0.9.1
-->

Stops an immediate from triggering.

## clearInterval(intervalObject)
<!-- YAML
added: v0.0.1
-->

Stops an interval from triggering.

## clearTimeout(timeoutObject)
<!-- YAML
added: v0.0.1
-->

Prevents a timeout from triggering.

## ref()
<!-- YAML
added: v0.9.1
-->

If you had previously `unref()`d a timer you can call `ref()` to explicitly
request the timer hold the program open. If the timer is already `ref`d calling
Expand All @@ -26,6 +41,9 @@ request the timer hold the program open. If the timer is already `ref`d calling
Returns the timer.

## setImmediate(callback[, arg][, ...])
<!-- YAML
added: v0.9.1
-->

To schedule the "immediate" execution of `callback` after I/O events
callbacks and before [`setTimeout`][] and [`setInterval`][]. Returns an
Expand All @@ -40,6 +58,9 @@ until the next event loop iteration.
If `callback` is not a function `setImmediate()` will throw immediately.

## setInterval(callback, delay[, arg][, ...])
<!-- YAML
added: v0.0.1
-->

To schedule the repeated execution of `callback` every `delay` milliseconds.
Returns a `intervalObject` for possible use with `clearInterval()`. Optionally
Expand All @@ -52,6 +73,9 @@ milliseconds (approximately 25 days) or less than 1, Node.js will use 1 as the
If `callback` is not a function `setInterval()` will throw immediately.

## setTimeout(callback, delay[, arg][, ...])
<!-- YAML
added: v0.0.1
-->

To schedule execution of a one-time `callback` after `delay` milliseconds.
Returns a `timeoutObject` for possible use with `clearTimeout()`. Optionally you
Expand All @@ -69,6 +93,9 @@ immediately, as if the `delay` was set to 1.
If `callback` is not a function `setTimeout()` will throw immediately.

## unref()
<!-- YAML
added: v0.9.1
-->

The opaque value returned by [`setTimeout`][] and [`setInterval`][] also has the
method `timer.unref()` which will allow you to create a timer that is active but
Expand Down
Loading