0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
Commit Graph

13016 Commits

Author SHA1 Message Date
Peter Lyons
b004bbd9bd doc: spell writable consistently
Docs have 108 instances of "writable" and only 1 "writeable" so
fix this one.

PR-URL: https://github.com/nodejs/node/pull/4954
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
2016-01-30 00:22:42 +01:00
Fedor Indutny
b4ece1b7ec contextify: use offset/length from Uint8Array
Do not blindly take data from underlying `ArrayBuffer`, use
`ByteOffset`/`ByteLength` of `Uint8Array` itself.

Additionally, fix tests that weren't actually properly running because
of V8's internal code cache. The code should be different, otherwise the
cached data won't be used at all.

Fix: #4939
PR-URL: https://github.com/nodejs/node/pull/4947
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-01-29 17:16:20 -05:00
Matteo Collina
137f53c7b7 dgram: support dgram.send with multiple buffers
Added ability to dgram.send to send multiple buffers, _writev style.
The offset and length parameters in dgram.send are now optional.
Refactored the dgram benchmarks, and seperated them from net.
Added docs for the new signature.

Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Fixes: https://github.com/nodejs/node/issues/4302
PR-URL: https://github.com/nodejs/node/pull/4374
2016-01-29 19:26:44 +01:00
Minwoo Jung
4126441013 benchmark: add a constant declaration for net
Constant declaration for `net` is omitted in `idle_server.js`
Add a constant declaration for constant `net`

PR-URL: https://github.com/nodejs/node/pull/3950
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
2016-01-29 20:40:35 +09:00
Rich Trott
9429685d48 test,buffer: refactor redeclarations
Many variables in the buffer tests are redeclared. Change them so that
they are scoped appropriately.

PR-URL: https://github.com/nodejs/node/pull/4893
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-01-28 15:13:24 -08:00
Rich Trott
2ac47f87a4 buffer: refactor redeclared variables
A handful of variable declarations in `lib/buffer.js` redeclare the same
variable in the same scope. This change removes each redeclaration by
switching to `const`, switching to `let`, or explicitly hoisting the
`var` declaration.

PR-URL: https://github.com/nodejs/node/pull/4886
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Roman Klauke <romaaan.git@gmail.com>
2016-01-28 14:11:22 -08:00
Santiago Gimeno
795eeb1ccf test: fix test-tls-zero-clear-in flakiness
It can happen that the server-side socket is destroyed before the
client-side socket has gracefully closed, thus causing a 'ECONNRESET'
error in this socket. To solve this, also close gracefully in the server
side too.

PR-URL: https://github.com/nodejs/node/pull/4888
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-01-28 11:44:29 -08:00
cjihrig
efd33a2a9a test: update arrow function style
This commit applies new arrow function linting rules across the
codebase. As it turns out, the only offenders were in the test
directory.

PR-URL: https://github.com/nodejs/node/pull/4813
Reviewed-By: Rod Vagg <rod@vagg.org>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
2016-01-28 11:31:31 -05:00
cjihrig
452928eb24 tools: add arrow function rules to eslint
This commit enables the following rules:
* arrow-parens - requires parens around arrow function arguments
* arrow-spacing - ensures a space on each side of the =>
* no-arrow-condition - prevents accidental use of => in cases
where the user really intends to use <=

PR-URL: https://github.com/nodejs/node/pull/4813
Reviewed-By: Rod Vagg <rod@vagg.org>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
2016-01-28 11:31:14 -05:00
Kári Tristan Helgason
3218dfbe60 doc: update eol handling in readline
This commit explicitly calls out the end of line sequences
used to generate line events in the readline module.

Fixes: https://github.com/nodejs/node/issues/4916
PR-URL: https://github.com/nodejs/node/pull/4927
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-01-28 10:08:33 -05:00
Adam Langley
b8ae0f7b0c crypto: fix build when OCSP-stapling not provided
node_crypto.cc attempts to handle the case where OCSP stapling APIs
aren't provided by using NODE__HAVE_TLSEXT_STATUS_CB. But the build
would actually fail in this case because of a couple of places that were
missing #ifdefs.

With this change the build works although, as expected,
test-tls-ocsp-callback.js will fail.

PR-URL: https://github.com/nodejs/node/pull/4914
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Shigeki Ohtsu <ohtsu@iij.ad.jp>
2016-01-28 15:00:34 +09:00
Kári Tristan Helgason
fcae05e4b5 url: change scoping of variables with let
Also changes some `var`s to `const` as they never change.

PR-URL: https://github.com/nodejs/node/pull/4867
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-01-27 14:54:50 -08:00
Adam Langley
f8d24c54a8 crypto: use a const SSL_CIPHER
SSL_CIPHER objects are conceptually const in any case and this allows
STACK_OF(SSL_CIPHER) to return a const pointer, as is done in BoringSSL
and, perhaps, OpenSSL in the future.

PR-URL: https://github.com/nodejs/node/pull/4913
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-01-27 17:28:51 -05:00
Fedor Indutny
ff4006c7b0 tls_wrap: reach error reporting for UV_EPROTO
Do not swallow error details when reporting UV_EPROTO asynchronously,
and when creating artificial errors.

Fix: #3692
PR-URL: https://github.com/nodejs/node/pull/4885
Reviewed-By: Shigeki Ohtsu <ohtsu@iij.ad.jp>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-01-27 17:27:52 -05:00
Vladimir Kurchatkin
b4313cf9a2 test: remove Object.observe from tests
Testing this wasn't really useful, besides Object.observe is going to be
deprecated.

Also this test fails with Chakra (#4765) for obvious reason.

PR-URL: https://github.com/nodejs/node/pull/4769
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
2016-01-27 23:02:53 +01:00
Benjamin Gruenbaum
334a7e3614 doc: replace function expressions with arrows
This commit replaces multiple usages of `function(){}` with ES2015
arrow functions in places it was forgotten earlier. The goal is to
make the docs more consistent since other functions were already
replaced with ES2015 arrows.

In addition, it fixes invalid syntax in modules.markdown to valid
syntax as well as remove `var self = this` pattern usages in the code
where they are now possible to avoid through arrow functions.

PR-URL: https://github.com/nodejs/node/pull/4832
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-01-27 23:00:20 +01:00
Sakthipriyan Vairamani
4714abb482 doc: show links consistently in deprecations
PR-URL: https://github.com/nodejs/node/pull/4907
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-01-27 13:42:45 -08:00
Bryan English
9cd4b76d4d doc: add docs working group
PR-URL: https://github.com/nodejs/node/pull/4244
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
2016-01-27 13:29:59 -08:00
Rich Trott
0351b2f1b4 test: refactor switch
`test-child-process-fork-net2.js` has a switch statement with 6 cases.
Each case uses `child.send()`, passing an object for the callback.
`child.send()` ignores the callback because it is not a function.
Removing the unused argument.

PR-URL: https://github.com/nodejs/node/pull/4870
Reviewed-By: Alexis Campailla <orangemocha@nodejs.org>
2016-01-27 12:20:26 -08:00
Rich Trott
cee14f52a3 test: remove race condition in http flood test
Timer race results in some flakiness on slower devices in CI. Remove
unneeded setTimeout() and replace booleans with common.mustCall().

PR-URL: https://github.com/nodejs/node/pull/4793
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-01-27 10:34:41 -08:00
cjihrig
c3bb4b1aa5 child_process: add shell option to spawn()
This commit adds a shell option, to spawn() and spawnSync(). This
option allows child processes to be spawned with or without a
shell. The option also allows a custom shell to be defined, for
compatibility with exec()'s shell option.

Fixes: https://github.com/nodejs/node/issues/1009
PR-URL: https://github.com/nodejs/node/pull/4598
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-01-26 19:40:43 -05:00
Rich Trott
34daaa764f test: scope redeclared variable
`test-assert.js` redeclares a variable with `var`. This change converts
it to a `const` declaration and wraps it in a standalone block to scope
it to just the test that uses it.

PR-URL: https://github.com/nodejs/node/pull/4854
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: targos - Michaël Zasso <mic.besace@gmail.com>
2016-01-26 15:39:25 -08:00
Rich Trott
6a73dbad51 tls: scope loop vars with let
`lib/_tls_common.js` had instances of `for` loops that defined variables
with `var` such that they were re-declared in the same scope. This
change scopes those variables with `let` so that they are not
re-declared.

PR-URL: https://github.com/nodejs/node/pull/4853
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
2016-01-26 20:53:05 +01:00
Dmitriy Lazarev
2c426355df doc: remove unnecessary bind(this)
PR-URL: https://github.com/nodejs/node/pull/4797
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Chris Dickinson <chris@neversaw.us>
Reviewed-By: Roman Reiss <me@silverwind.io>
2016-01-26 20:49:13 +01:00
Sakthipriyan Vairamani
0a1859d33a doc: keep the names in sorted order
1. The release team's names were not in the sorted order and

2. the old list of releasers' names were not in bold

This patch fixes both of these issues

PR-URL: https://github.com/nodejs/node/pull/4876
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Roman Klauke <romaaan.git@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
2016-01-26 20:07:19 +01:00
Jimb Esser
58086423f9 doc: fix nonsensical grammar in Buffer::write
PR-URL: https://github.com/nodejs/node/pull/4863
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
2016-01-26 20:05:17 +01:00
Myles Borins
321162df71 tools: add support for subkeys in release tools
Replace grep with awk to add support for subkeys

PR-URL: https://github.com/nodejs/node/pull/4807
Reviewed-By: Rod Vagg <rod@vagg.org>
2016-01-26 09:05:33 -08:00
cjihrig
57003520f8 src: attach error to stack on displayErrors
The vm module's displayErrors option attaches error arrow
messages as a hidden property. Later, core JavaScript code
can optionally decorate the error stack with the arrow message.
However, when user code catches an error, it has no way to
access the arrow message. This commit changes the behavior of
displayErrors to mean "decorate the error stack if an error
occurs."

Fixes: https://github.com/nodejs/node/issues/4835
PR-URL: https://github.com/nodejs/node/pull/4874
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-01-26 11:03:13 -05:00
Roman Reiss
d66f18e6cd test: fix irregular whitespace issue
PR-URL: https://github.com/nodejs/node/pull/4864
Reviewed-By: targos - Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Roman Klauke <romaaan.git@gmail.com>
2016-01-26 17:01:41 +01:00
Roman Reiss
d4f31b5105 tools: enable assorted ESLint error rules
Enables assorted rules from the category of possible errors. These
should not get in the way in any form.

- http://eslint.org/docs/rules/no-control-regex
- http://eslint.org/docs/rules/no-extra-boolean-cast
- http://eslint.org/docs/rules/no-invalid-regexp
- http://eslint.org/docs/rules/no-irregular-whitespace
- http://eslint.org/docs/rules/no-unexpected-multiline

PR-URL: https://github.com/nodejs/node/pull/4864
Reviewed-By: targos - Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Roman Klauke <romaaan.git@gmail.com>
2016-01-26 17:01:35 +01:00
Drew Folta
9b1bc1dd05 test: fs.link() test runs on same device
When running the tests if `NODE_TEST_DIR` is set to a device different
than the location of the test files (where this repo is checked out),
then the parallel/test-fs-link.js test will fail with
`EXDEV: cross-device link not permitted`. The code works fine (and is in
fact throwing an error as desired) but the test fails.

This commit first creates the "source" file in the same directory as the
"destination" (where the hardlink will be created).

PR-URL: https://github.com/nodejs/node/pull/4861
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2016-01-26 13:53:19 +01:00
Rich Trott
457a1ca3a6 test: refactor test-net-settimeout
test-net-settimeout is unnecessarily complex. This change simplifies it.

PR-URL: https://github.com/nodejs/node/pull/4799
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
2016-01-25 21:58:56 -08:00
Evan Lucas
0f8e63caff dns: throw a TypeError in lookupService with invalid port
Previously, port was assumed to be a number and would cause an abort in
cares_wrap. This change throws a TypeError if port is not a number
before we actually hit C++.

Fixes: https://github.com/nodejs/node/issues/4837
PR-URL: https://github.com/nodejs/node/pull/4839
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Roman Klauke <romaaan.git@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
2016-01-25 15:15:31 -06:00
Alexander Makarenko
8ba5631625 doc: add servername parameter docs
Add `servername` parameter docs for `https.request()` method.

Follows #4389

PR-URL: https://github.com/nodejs/node/pull/4729
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
2016-01-25 19:12:36 +01:00
Jackson Tian
accd69ef63 doc: fix code type of markdowns
1. correct code type in addons.markdown
2. add missed code type in crypto.markdown

PR-URL: https://github.com/nodejs/node/pull/4858
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Roman Klauke <romaaan.git@gmail.com>
2016-01-25 16:08:46 +01:00
Rich Trott
06a5072b38 stream: refactor redeclared variables
`lib/_stream_readable.js` contained three instances of `var`
declarations occurring twice in the same scope. Refactored to `const` or
`let` as appropriate.

PR-URL: https://github.com/nodejs/node/pull/4816
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-01-24 21:27:22 -08:00
Rich Trott
c6d29cb81f test: mark test-tick-processor flaky
PR-URL: https://github.com/nodejs/node/pull/4809
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Reviewed-By: James M Snell <jasnell@gmail.com>
Ref: https://github.com/nodejs/node/issues/4427
2016-01-24 21:18:08 -08:00
Fedor Indutny
96934cbb30 vm: introduce cachedData/produceCachedData
Introduce `cachedData`/`produceCachedData` options for `v8.Script`.
Could be used to consume/produce V8's code cache for speeding up
compilation of known code.

PR-URL: https://github.com/nodejs/node/pull/4777
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-01-24 16:34:55 -05:00
Benjamin Gruenbaum
83e43fbb04 doc: check for errors in 'listen' event
In the docs we typically check for errors and surface them. This
is IMO a good idea and good practice. This PR adds a check for
errors in three places in the `net` docs where it was missing.

PR-URL: https://github.com/nodejs/node/pull/4834
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Roman Klauke <romaaan.git@gmail.com>>
2016-01-24 19:50:43 +01:00
Jeff Harris
f19b9d6b8c doc: undo move http.IncomingMessage.statusMessage
The description for `statusMessage` was accidentally moved under the
heading for `http.IncomingMessage.socket`.  This commit puts it back
in the correct place.

PR-URL: https://github.com/nodejs/node/pull/4822
Fixes: https://github.com/nodejs/node/issues/4558
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Roman Klauke <romaaan.git@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
2016-01-24 14:50:30 +01:00
Roman Reiss
55607a0f32 doc: style fixes for the TOC
- Hide the scrollbar on the TOC on all browsers. It was never the
  intention for it to be visible with the scroll indication in place.
  A wrapper element with 20px padding was added to accommodate for
  hopefully all scrollbar widths as well as to avoid overflowing
  content.
- Fixed the scroll indication gradient on Safari, which was caused by
  the wrong from-color, which now matches the to-color.
- Fixed a issue in old IE where the TOC didn't render on the correct
  position through setting `left: 0` and `top: 0` on it.

PR-URL: https://github.com/nodejs/node/pull/4748
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-01-23 23:10:43 +01:00
Benjamin Gruenbaum
c00d08f5ec fs: remove unused branches
In a few places the code was refactored to use `maybeCallback` which
always returns a function. Checking for `if (callback)` always returns
true anyway.

PR-URL: https://github.com/nodejs/node/pull/4795
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: thefourtheye <thechargingvolcano@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
2016-01-23 19:44:08 +01:00
Brian White
922d53897d tools: fix setting path containing an ampersand
This commit fixes an issue with the Node.js command prompt
on Windows where the PATH environment variable would not be
set correctly if the existing PATH contained an '&'.

Fixes: https://github.com/nodejs/node/issues/4802
PR-URL: https://github.com/nodejs/node/pull/4804
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-01-23 04:08:45 -05:00
Robert Jefe Lindstaedt
17d5a3ab99 doc: proper markdown escaping -> \_\_, \*, \_
PR-URL: https://github.com/nodejs/node/pull/4805
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
2016-01-22 21:32:50 -08:00
Glen Arrowsmith
26073dd1c1 doc: Examples work when data exceeds buffer size
PR-URL: https://github.com/nodejs/node/pull/4811
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Shigeki Ohtsu <ohtsu@iij.ad.jp>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-01-22 20:34:38 -08:00
Kat Marchán
518548f1d8 doc: update list of personal traits in CoC
https://github.com/rust-lang/rust-www/pull/288 landed in the Rust repo
so it seems like a good idea to just bring the updated list in.

We also received a request to do this in https://github.com/nodejs/inclusivity/issues/82
so this should resolve that.

Thanks to [@Charlotteis](https://github.com/Charlotteis) for bringing
up the original issue.

Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Myles Borins <mborins@us.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/4801
Fixes: https://github.com/nodejs/inclusivity/issues/82
2016-01-22 13:36:01 -08:00
Robert Jefe Lindstaedt
4e1023d6b4 doc: harmonize $ node command line notation
PR-URL: https://github.com/nodejs/node/pull/4806
Reviewed-By: Stephan Belanger <admin@stephenbelanger.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
2016-01-22 19:57:19 +01:00
Karl Skomski
2bcea02e24 doc: add buf.indexOf encoding param with example
PR-URL: https://github.com/nodejs/node/pull/3373
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2016-01-22 11:50:54 -07:00
Trevor Norris
54cd2e1e5e buffer: properly retrieve binary length of needle
If the needle contains an extended latin-1 character then using
String::Utf8Length() will be too large and the search will return early.
Instead use String::Length() when encoding is BINARY.

PR-URL: https://github.com/nodejs/node/pull/4803
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-01-22 11:32:43 -07:00
Trevor Norris
7240ad4441 buffer: allow encoding param to collapse
Currently the signature is indexOf(val[, byteOffset[, encoding]])
Instead allow indexOf(val[, byteOffset][, encoding])
so that byteOffset does not need to be passed.

PR-URL: https://github.com/nodejs/node/pull/4803
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-01-22 11:32:16 -07:00