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: document deprecation of util._extend #4902

Closed
wants to merge 25 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
10ba94f
Refactor self=this
benjamingr Jan 24, 2016
60e4ad3
Update self=this in http.js
benjamingr Jan 24, 2016
1ebb5b2
Refactor self=this to arrows
benjamingr Jan 24, 2016
dd96a00
fix leading whitespace linter issue
benjamingr Jan 24, 2016
889f467
fix emberrasing mistake
benjamingr Jan 25, 2016
5f8b49d
doc: undo move http.IncomingMessage.statusMessage
techjeffharris Jan 22, 2016
e82760f
doc: check for errors in 'listen' event
benjamingr Jan 24, 2016
efc4f01
vm: introduce `cachedData`/`produceCachedData`
indutny Jan 21, 2016
0e16694
test: mark test-tick-processor flaky
Trott Jan 21, 2016
29775ae
stream: refactor redeclared variables
Trott Jan 22, 2016
1164bcb
doc: fix code type of markdowns
JacksonTian Jan 25, 2016
d3ce9d3
doc: add `servername` parameter docs
estliberitas Jan 17, 2016
085c5a0
dns: throw a TypeError in lookupService with invalid port
evanlucas Jan 24, 2016
38aa39d
test: refactor test-net-settimeout
Trott Jan 21, 2016
516d5da
test: fs.link() test runs on same device
drewfish Jan 25, 2016
935768b
tools: enable assorted ESLint error rules
silverwind Jan 25, 2016
a6f50c6
test: fix irregular whitespace issue
silverwind Jan 25, 2016
db19416
src: attach error to stack on displayErrors
cjihrig Jan 26, 2016
25c4f98
tools: add support for subkeys in release tools
MylesBorins Jan 21, 2016
1348386
doc: fix nonsensical grammar in Buffer::write
Jimbly Jan 25, 2016
69176e1
doc: keep the names in sorted order
thefourtheye Jan 26, 2016
4b876bf
doc: remove unnecessary bind(this)
wKich Jan 21, 2016
5d8a742
tls: scope loop vars with let
Trott Jan 25, 2016
e99a50d
test: scope redeclared variable
Trott Jan 14, 2016
ae09fc2
doc: document deprecation of util._extend
benjamingr Jan 27, 2016
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
10 changes: 10 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,16 @@ rules:
no-unreachable: 2
## require valid typeof compared string like typeof foo === 'strnig'
valid-typeof: 2
## disallow controls characters in regular expressions
no-control-regex: 2
## disallow extra boolean casts
no-extra-boolean-cast : 2
## validate regular expressions
no-invalid-regexp: 2
## forbid weird whitespace characters
no-irregular-whitespace: 2
## avoid unexpected multiline expressions
no-unexpected-multiline: 2

# Best Practices
# list: https://github.com/eslint/eslint/tree/master/docs/rules#best-practices
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -440,12 +440,12 @@ Releases of Node.js and io.js will be signed with one of the following GPG keys:

* **Chris Dickinson** <christopher.s.dickinson@gmail.com> `9554F04D7259F04124DE6B476D5A82AC7E37093B`
* **Colin Ihrig** <cjihrig@gmail.com> `94AE36675C464D64BAFA68DD7434390BDBE9B9C5`
* **Sam Roberts** <octetcloud@keybase.io> `0034A06D9D9B0064CE8ADF6BF1747F4AD2306D93`
* **Jeremiah Senkpiel** <fishrock@keybase.io> `FD3A5288F042B6850C66B31F09FE44734EB7990E`
* **Evan Lucas** <evanlucas@me.com> `B9AE9905FFD7803F25714661B63B535A4C206CA9`
* **James M Snell** <jasnell@keybase.io> `71DCFD284A79C3B38668286BC97EC7A07EDE3FC1`
* **Rod Vagg** <rod@vagg.org> `DD8F2338BAE7501E3DD5AC78C273792F7D83545D`
* **Jeremiah Senkpiel** <fishrock@keybase.io> `FD3A5288F042B6850C66B31F09FE44734EB7990E`
* **Myles Borins** <myles.borins@gmail.com> `C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8`
* **Evan Lucas** <evanlucas@me.com> `B9AE9905FFD7803F25714661B63B535A4C206CA9`
* **Rod Vagg** <rod@vagg.org> `DD8F2338BAE7501E3DD5AC78C273792F7D83545D`
* **Sam Roberts** <octetcloud@keybase.io> `0034A06D9D9B0064CE8ADF6BF1747F4AD2306D93`

The full set of trusted release keys can be imported by running:

Expand All @@ -466,6 +466,6 @@ details on what to do with these keys to verify that a downloaded file is offici
Previous releases of Node.js have been signed with one of the following GPG
keys:

* Julien Gilli <jgilli@fastmail.fm> `114F43EE0176B71C7BC219DD50A3051F888C628D`
* Timothy J Fontaine <tjfontaine@gmail.com> `7937DFD2AB06298B2293C3187D33FF9D0246406D`
* Isaac Z. Schlueter <i@izs.me> `93C7E9E91B49E432C2F75674B0A78B0A6C481CF6`
* **Isaac Z. Schlueter** <i@izs.me> `93C7E9E91B49E432C2F75674B0A78B0A6C481CF6`
* **Julien Gilli** <jgilli@fastmail.fm> `114F43EE0176B71C7BC219DD50A3051F888C628D`
* **Timothy J Fontaine** <tjfontaine@gmail.com> `7937DFD2AB06298B2293C3187D33FF9D0246406D`
2 changes: 1 addition & 1 deletion doc/api/addons.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ adding the function as a property of `exports`.

To test it, run the following JavaScript:

```cpp
```js
// test.js
const addon = require('./build/Release/addon');

Expand Down
2 changes: 1 addition & 1 deletion doc/api/buffer.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -1008,7 +1008,7 @@ When undefined, `offset` defaults to `0`, and `encoding` defaults to `'utf8'`.
The `length` parameter is the number of bytes to write, when undefined `length`
defaults to `buffer.length - offset`. If the Buffer did not contain enough
space to fit the entire string, only a partial amount of the string will be
written however, the will not write only partially encoded characters. The
written however, it will not write only partially encoded characters. The
return value indicates the number of octets written.

```js
Expand Down
2 changes: 1 addition & 1 deletion doc/api/crypto.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ decipher.end();

Example: Using `Decipher` and piped streams:

```
```js
const crypto = require('crypto');
const fs = require('fs');
const decipher = crypto.createDecipher('aes192', 'a password');
Expand Down
4 changes: 2 additions & 2 deletions doc/api/http.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -939,15 +939,15 @@ The 3-digit HTTP response status code. E.G. `404`.

**Only valid for response obtained from [`http.ClientRequest`][].**

The HTTP response status message (reason phrase). E.G. `OK` or `Internal Server Error`.

### message.socket

The [`net.Socket`][] object associated with the connection.

With HTTPS support, use [`request.socket.getPeerCertificate()`][] to obtain the
client's authentication details.

The HTTP response status message (reason phrase). E.G. `OK` or `Internal Server Error`.

### message.trailers

The request/response trailers object. Only populated at the `'end'` event.
Expand Down
1 change: 1 addition & 0 deletions doc/api/https.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ The following options from [`tls.connect()`][] can also be specified. However, a
- `secureProtocol`: The SSL method to use, e.g. `SSLv3_method` to force
SSL version 3. The possible values depend on your installation of
OpenSSL and are defined in the constant [`SSL_METHODS`][].
- `servername`: Servername for SNI (Server Name Indication) TLS extension.

In order to specify these options, use a custom [`Agent`][].

Expand Down
22 changes: 15 additions & 7 deletions doc/api/net.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ var server = net.createServer((socket) => {
});

// grab a random port.
server.listen(() => {
server.listen((err) => {
if (err) throw err;
address = server.address();
console.log('opened server on %j', address);
});
Expand Down Expand Up @@ -528,7 +529,8 @@ Here is an example of a client of the previously described echo server:

```js
const net = require('net');
const client = net.connect({port: 8124}, () => { //'connect' listener
const client = net.connect({port: 8124}, () => {
// 'connect' listener
console.log('connected to server!');
client.write('world!\r\n');
});
Expand Down Expand Up @@ -581,8 +583,8 @@ Here is an example of a client of the previously described echo server:

```js
const net = require('net');
const client = net.connect({port: 8124},
() => { //'connect' listener
const client = net.connect({port: 8124}, () => {
//'connect' listener
console.log('connected to server!');
client.write('world!\r\n');
});
Expand Down Expand Up @@ -649,15 +651,18 @@ on port 8124:

```js
const net = require('net');
const server = net.createServer((c) => { //'connection' listener
const server = net.createServer((c) => {
// 'connection' listener
console.log('client connected');
c.on('end', () => {
console.log('client disconnected');
});
c.write('hello\r\n');
c.pipe(c);
});
server.listen(8124, () => { //'listening' listener
server.listen(8124, (err) => {
// 'listening' listener
if (err) throw err;
console.log('server bound');
});
```
Expand All @@ -672,7 +677,10 @@ To listen on the socket `/tmp/echo.sock` the third line from the last would
just be changed to

```js
server.listen('/tmp/echo.sock', () => { /* 'listening' listener*/ })
server.listen('/tmp/echo.sock', (err) => {
// 'listening' listener
if (err) throw err;
});
```

Use `nc` to connect to a UNIX domain socket server:
Expand Down
2 changes: 1 addition & 1 deletion doc/api/process.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@ function MyThing(options) {

process.nextTick(() => {
this.startDoingStuff();
}.bind(this));
});
}

var thing = new MyThing();
Expand Down
13 changes: 12 additions & 1 deletion doc/api/util.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -544,10 +544,21 @@ Deprecated predecessor of `console.log`.

## util.puts([...])

Stability: 0 - Deprecated: Use console.log() instead.
Stability: 0 - Deprecated: Use `console.log()` instead.

Deprecated predecessor of `console.log`.


## util._extend(obj)

Stability: 0 - Deprecated: Use Object.assign() instead.

`_extend` was never intended to be used outside of internal NodeJS modules. The
community found and used it.

It is deprecated and should not be used in new code. JavaScript comes with very
similar built in functionality through `Object.assign`.

[`Array.isArray`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray
[constructor]: https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object/constructor
[Customizing `util.inspect` colors]: #util_customizing_util_inspect_colors
Expand Down
30 changes: 18 additions & 12 deletions doc/api/vm.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,18 @@ The options when creating a script are:
displayed in stack traces
- `columnOffset`: allows you to add an offset to the column number that is
displayed in stack traces
- `displayErrors`: whether or not to print any errors to stderr, with the
line of code that caused them highlighted, before throwing an exception.
Applies only to syntax errors compiling the code; errors while running the
code are controlled by the options to the script's methods.
- `displayErrors`: if `true`, on error, attach the line of code that caused
the error to the stack trace. Applies only to syntax errors compiling the
code; errors while running the code are controlled by the options to the
script's methods.
- `timeout`: a number of milliseconds to execute `code` before terminating
execution. If execution is terminated, an [`Error`][] will be thrown.
- `cachedData`: an optional `Buffer` with V8's code cache data for the supplied
source. When supplied `cachedDataRejected` value will be set to either
`true` or `false` depending on acceptance of the data by V8.
- `produceCachedData`: if `true` and no `cachedData` is present - a `Buffer`
with V8's code cache data will be produced and stored in `cachedData` property
of the returned `vm.Script` instance.

### script.runInContext(contextifiedSandbox[, options])

Expand Down Expand Up @@ -144,10 +150,10 @@ The options for running a script are:
displayed in stack traces
- `columnOffset`: allows you to add an offset to the column number that is
displayed in stack traces
- `displayErrors`: whether or not to print any errors to stderr, with the
line of code that caused them highlighted, before throwing an exception.
Applies only to runtime errors executing the code; it is impossible to create
a `Script` instance with syntax errors, as the constructor will throw.
- `displayErrors`: if `true`, on error, attach the line of code that caused
the error to the stack trace. Applies only to runtime errors executing the
code; it is impossible to create a `Script` instance with syntax errors, as
the constructor will throw.
- `timeout`: a number of milliseconds to execute the script before terminating
execution. If execution is terminated, an [`Error`][] will be thrown.

Expand Down Expand Up @@ -284,10 +290,10 @@ e.g. `(0,eval)('code')`. However, it also has the following additional options:
displayed in stack traces
- `columnOffset`: allows you to add an offset to the column number that is
displayed in stack traces
- `displayErrors`: whether or not to print any errors to stderr, with the
line of code that caused them highlighted, before throwing an exception.
Will capture both syntax errors from compiling `code` and runtime errors
thrown by executing the compiled code. Defaults to `true`.
- `displayErrors`: if `true`, on error, attach the line of code that caused
the error to the stack trace. Will capture both syntax errors from compiling
`code` and runtime errors thrown by executing the compiled code. Defaults to
`true`.
- `timeout`: a number of milliseconds to execute `code` before terminating
execution. If execution is terminated, an [`Error`][] will be thrown.

Expand Down
12 changes: 6 additions & 6 deletions lib/_stream_readable.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,10 @@ function readableAddChunk(stream, state, chunk, encoding, addToFront) {
onEofChunk(stream, state);
} else if (state.objectMode || chunk && chunk.length > 0) {
if (state.ended && !addToFront) {
var e = new Error('stream.push() after EOF');
const e = new Error('stream.push() after EOF');
stream.emit('error', e);
} else if (state.endEmitted && addToFront) {
var e = new Error('stream.unshift() after end event');
const e = new Error('stream.unshift() after end event');
stream.emit('error', e);
} else {
if (state.decoder && !addToFront && !encoding)
Expand Down Expand Up @@ -640,13 +640,13 @@ Readable.prototype.unpipe = function(dest) {
state.pipesCount = 0;
state.flowing = false;

for (var i = 0; i < len; i++)
for (let i = 0; i < len; i++)
dests[i].emit('unpipe', this);
return this;
}

// try to find the right one.
var i = state.pipes.indexOf(dest);
const i = state.pipes.indexOf(dest);
if (i === -1)
return this;

Expand Down Expand Up @@ -847,7 +847,7 @@ function fromList(n, state) {
if (n < list[0].length) {
// just take a part of the first list item.
// slice is the same for buffers and strings.
var buf = list[0];
const buf = list[0];
ret = buf.slice(0, n);
list[0] = buf.slice(n);
} else if (n === list[0].length) {
Expand All @@ -863,7 +863,7 @@ function fromList(n, state) {

var c = 0;
for (var i = 0, l = list.length; i < l && c < n; i++) {
var buf = list[0];
const buf = list[0];
var cpy = Math.min(n - c, buf.length);

if (stringMode)
Expand Down
8 changes: 4 additions & 4 deletions lib/_tls_common.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ exports.createSecureContext = function createSecureContext(options, context) {
// cert's issuer in C++ code.
if (options.ca) {
if (Array.isArray(options.ca)) {
for (var i = 0, len = options.ca.length; i < len; i++) {
for (let i = 0, len = options.ca.length; i < len; i++) {
c.context.addCACert(options.ca[i]);
}
} else {
Expand All @@ -60,7 +60,7 @@ exports.createSecureContext = function createSecureContext(options, context) {

if (options.cert) {
if (Array.isArray(options.cert)) {
for (var i = 0; i < options.cert.length; i++)
for (let i = 0; i < options.cert.length; i++)
c.context.setCert(options.cert[i]);
} else {
c.context.setCert(options.cert);
Expand All @@ -73,7 +73,7 @@ exports.createSecureContext = function createSecureContext(options, context) {
// which leads to the crash later on.
if (options.key) {
if (Array.isArray(options.key)) {
for (var i = 0; i < options.key.length; i++) {
for (let i = 0; i < options.key.length; i++) {
var key = options.key[i];

if (key.passphrase)
Expand Down Expand Up @@ -108,7 +108,7 @@ exports.createSecureContext = function createSecureContext(options, context) {

if (options.crl) {
if (Array.isArray(options.crl)) {
for (var i = 0, len = options.crl.length; i < len; i++) {
for (let i = 0, len = options.crl.length; i < len; i++) {
c.context.addCRL(options.crl[i]);
}
} else {
Expand Down
3 changes: 3 additions & 0 deletions lib/dns.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,9 @@ exports.lookupService = function(host, port, callback) {
if (cares.isIP(host) === 0)
throw new TypeError('"host" argument needs to be a valid IP address');

if (typeof port !== 'number')
throw new TypeError(`"port" argument must be a number, got "${port}"`);

callback = makeAsync(callback);

var req = new GetNameInfoReqWrap();
Expand Down
Loading