Weijia Wang
e22b8d0c46
lib: improve the usage of TypeError[INVALID_ARG_TYPE]
...
The initials of expected in TypeError[ERR_INVALID_ARG_TYPE]
are inconsistent. This change is to unify them.
PR-URL: https://github.com/nodejs/node/pull/16401
Fixes: https://github.com/nodejs/node/issues/16383
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2017-11-12 11:04:06 -08:00
Weijia Wang
7a71cd7d0c
lib: move duplicate spliceOne into internal/util
...
lib/url.js and lib/events.js are using the same spliceOne function.
This change is to move it into the internal/util for avoiding duplicate
code.
PR-URL: https://github.com/nodejs/node/pull/16221
Reviewed-By: Timothy Gu <timothygu99@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com >
Reviewed-By: Refael Ackermann <refack@gmail.com >
2017-10-20 15:51:20 -04:00
Anatoli Papirovski
3c0ebf5aca
tools: enable additional eslint rules
...
Enable additional rules that node either already adheres to
or it makes sense to do so going forward: for-direction,
accessor-pairs, no-lonely-if and symbol-description.
Fix all instances of no-lonely-if in lib & test and disable
accessor-pairs in test-util-inspect.
PR-URL: https://github.com/nodejs/node/pull/16243
Refs: https://eslint.org/docs/rules/for-direction
Refs: https://eslint.org/docs/rules/accessor-pairs
Refs: https://eslint.org/docs/rules/no-lonely-if
Refs: https://eslint.org/docs/rules/symbol-description
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com >
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2017-10-19 13:54:14 -04:00
Yang-Kichang
7d55b81999
url: change variable name to be more descriptive
...
PR-URL: https://github.com/nodejs/node/pull/15551
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Timothy Gu <timothygu99@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2017-09-27 00:39:29 +02:00
Cyril Lakech
ed084a035c
url: remove unused code from autoEscapeStr
...
PR-URL: https://github.com/nodejs/node/pull/15086
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Timothy Gu <timothygu99@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2017-09-03 17:26:18 -03:00
Rich Trott
d14c13238b
lib: update indentation of ternaries
...
In preparation for stricter indentation linting and to increase code
clarity, update indentation for ternaries in lib.
PR-URL: https://github.com/nodejs/node/pull/14247
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
2017-07-17 22:09:46 -07:00
Rich Trott
0d22858d67
lib: remove excess indentation
...
In anticipation of stricter linting for indentation, remove instances of
extra indentation that will be flagged by the new rules.
PR-URL: https://github.com/nodejs/node/pull/14090
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2017-07-07 13:18:19 -07:00
Rich Trott
85dacd63f0
lib: use consistent indentation for ternaries
...
In anticipation of stricter linting for indentation issues, modify
ternary operators in lib that do not conform with the expected ESLint
settings.
PR-URL: https://github.com/nodejs/node/pull/14078
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2017-07-07 06:57:16 -07:00
Eduardo Leggiero
8520e6f280
lib: fix urlObject parameter name in url.format
...
Documentation, error message, and code now use the same argument name.
PR-URL: https://github.com/nodejs/node/pull/14031
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2017-07-05 09:58:47 -07:00
starkwang
473f0eff29
errors,url: port url errors to internal/errors
...
PR-URL: https://github.com/nodejs/node/pull/13963
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: Timothy Gu <timothygu99@gmail.com >
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2017-07-01 22:32:32 -04:00
Ruben Bridgewater
c474f88987
lib: fix typos
...
PR-URL: https://github.com/nodejs/node/pull/13741
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Roman Reiss <me@silverwind.io >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com >
2017-06-19 18:18:56 +02:00
Vse Mozhet Byt
878990498a
readline,repl,url,util: remove needless capturing
...
Use non-capturing grouping or remove capturing completely when:
* capturing is useless per se, e.g. in test() check;
* captured groups are not used afterwards at all;
* some of the later captured groups are not used afterwards.
PR-URL: https://github.com/nodejs/node/pull/13718
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2017-06-19 18:07:52 +03:00
Justin Beckwith
c88ba036b4
url: ensure search property is consistently null vs empty
...
PR-URL: https://github.com/nodejs/node/pull/13606
Fixes: https://github.com/nodejs/node/issues/13404
Reviewed-By: Timothy Gu <timothygu99@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2017-06-13 12:25:19 -07:00
James M Snell
b331ba6ca9
url: move to module.exports = {} pattern
...
PR-URL: https://github.com/nodejs/node/pull/12717
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com
2017-04-29 10:24:18 -07:00
Rich Trott
c005ebb0ce
url: improve descriptiveness of identifier
...
Change variable for protocols that do not always contain `//` to
`noLeadingSlashes` so someone reading the code knows what it means.
PR-URL: https://github.com/nodejs/node/pull/12579
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Richard Lau <riclau@uk.ibm.com >
Reviewed-By: Timothy Gu <timothygu99@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2017-04-24 13:13:44 -07:00
Pedro lima
c1dee6ac97
url: name anonymous functions in url
...
Name anonymous functions in url.js.
PR-URL: https://github.com/nodejs/node/pull/9225
Ref: https://github.com/nodejs/node/issues/8913
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com >
2017-03-26 12:40:24 +02:00
Timothy Gu
cfc8422a68
lib: use Object.create(null) directly
...
After V8 5.6, using Object.create(null) directly is now faster than
using a constructor for map-like objects.
PR-URL: https://github.com/nodejs/node/pull/11930
Refs: https://github.com/emberjs/ember.js/issues/15001
Refs: https://crrev.com/532c16eca071df3ec8eed394dcebb932ef584ee6
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2017-03-24 15:25:49 -07:00
James M Snell
98e54b0bd4
meta: restore original copyright header
...
A prior io.js era commit inappropriately removed the
original copyright statements from the source. This
restores those in any files still remaining from that
edit.
Ref: https://github.com/nodejs/TSC/issues/174
Ref: https://github.com/nodejs/node/pull/10599
PR-URL: https://github.com/nodejs/node/pull/10155
Note: This PR was required, reviewed-by and approved
by the Node.js Foundation Legal Committee and the TSC.
There is no `Approved-By:` meta data.
2017-03-10 11:23:48 -08:00
Daijiro Wachi
cccc6d8545
url: use hasIntl instead of try-catch
...
Like the other internal modules, we should use
`process.binding('config').hasIntl` instead of `try-catch`
to make sure `icu` is bonded or not.
PR-URL: https://github.com/nodejs/node/pull/11571
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Timothy Gu <timothygu99@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Jackson Tian <shyvo1987@gmail.com >
2017-03-04 08:04:08 -08:00
Timothy Gu
c2a302c50b
src: do not ignore IDNA conversion error
...
Old behavior can be restored using a special `lenient` mode, as used in
the legacy URL parser.
PR-URL: https://github.com/nodejs/node/pull/11549
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2017-02-28 18:32:01 -08:00
Timothy Gu
c6b12d0984
url: fix surrogate handling in encodeAuth()
...
Also factor out common parts in querystring and url.
PR-URL: https://github.com/nodejs/node/pull/11161
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Brian White <mscdex@mscdex.net >
2017-02-14 12:13:11 -08:00
DavidCai
78182458e6
url: fix error message of url.format
...
PR-URL: https://github.com/nodejs/node/pull/11162
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com >
Reviewed-By: Timothy Gu <timothygu99@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com >
2017-02-11 13:59:34 -08:00
James M Snell
c5e9654b5b
url: extend url.format to support WHATWG URL
...
Removes the non-standard options on WHATWG URL toString
and extends the existing url.format() API to support
customizable serialization of the WHATWG URL object.
This does not yet include the documentation updates
because the documentation for the new WHATWG URL object
has not yet landed.
Example:
```js
const url = require('url');
const URL = url.URL;
const myURL = new URL('http://example.org/?a=b#c ');
const str = url.format(myURL, {fragment: false, search: false});
console.log(str);
// Prints: http://example.org/
```
PR-URL: https://github.com/nodejs/node/pull/10857
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Timothy Gu <timothygu99@gmail.com >
Reviewed-By: Brian White <mscdex@mscdex.net >
2017-02-02 12:35:55 -08:00
Timothy Gu
e71c278288
url: stop exporting originFor()
...
PR-URL: https://github.com/nodejs/node/pull/10955
Fixes: https://github.com/nodejs/node/issues/10800
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
2017-01-27 07:35:36 -08:00
Timothy Gu
326e967c6b
url: export URLSearchParams
...
Fixes : #10761
2017-01-22 11:27:58 +01:00
James M Snell
abc1633de6
url: move originFor, domainToAscii and domainToUnicode
...
Move non-standard methods to `url` module instead of exposing as
static methods on the `URL` object.
PR-URL: https://github.com/nodejs/node/pull/10512
Reviewed-By: Italo A. Casas <me@italoacasas.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
2016-12-30 10:14:10 -08:00
Junshu Okamoto
c65d55f087
url: do not truncate long hostnames
...
Currently, around line 417 lib/url.js is truncating hostname and put the
rest of hostname to the path if hostname length after `.` is equal or
more than 63. This behavior is different from browser behavior. I
changed the code so that it doesn’t truncate.
I also added the test example which has more than 63 length in after
`.` in hostname in test url.
PR-URL: https://github.com/nodejs/node/pull/9292
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Brian White <mscdex@mscdex.net >
2016-12-24 21:06:23 -08:00
Michaël Zasso
966e5cfb81
tools: enforce linebreak after ternary operators
...
This is to be consistent with the other operators and helps
understanding the context when the code is grepped.
PR-URL: https://github.com/nodejs/node/pull/10213
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com >
Reviewed-By: Teddy Katz <teddy.katz@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2016-12-22 20:27:59 -08:00
Axel Monroy
1be73e828d
url: add a got host pattern in url.js
...
Add a hostPattern variable for readable purposes
PR-URL: https://github.com/nodejs/node/pull/9653
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Brian White <mscdex@mscdex.net >
2016-12-06 12:37:24 -08:00
joyeecheung
4422c35c5e
test,url: improve escaping in url.parse
...
- rename variables in autoEscapeStr so they are easier to understand
- comment the escaping algorithm
- increase coverage for autoEscapeStr
PR-URL: https://github.com/nodejs/node/pull/10083
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2016-12-05 00:44:38 +01:00
Prince J Wesley
0f4c7b8c37
lib,tools: remove unneeded escaping of /
...
The `/` character does not need to be escaped when occurring inside a
character class in a regular expression. Remove such instances of
escaping in the code base.
PR-URL: https://github.com/nodejs/node/pull/9591
Reviewed-By: Teddy Katz <teddy.katz@gmail.com >
2016-11-23 22:06:24 -08:00
Rich Trott
7ef16eee2f
lib,test: remove unneeded escaping of /
...
The `/` character does not need to be escaped when occurring inside a
character class in a regular expression. Remove such instances of
escaping in the code base.
PR-URL: https://github.com/nodejs/node/pull/9485
Reviewed-By: Prince John Wesley <princejohnwesley@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Teddy Katz <teddy.katz@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Roman Reiss <me@silverwind.io >
2016-11-09 16:40:38 -08:00
James M Snell
4b312387ea
url: adding WHATWG URL support
...
Implements WHATWG URL support. Example:
```
var u = new url.URL('http://example.org ');
```
Currently passing all WHATWG url parsing tests and all but two of the
setter tests. The two setter tests are intentionally skipped for now
but will be revisited.
PR-URL: https://github.com/nodejs/node/pull/7448
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com >
2016-10-11 12:41:42 -07:00
Luigi Pinca
63493e1cb3
url: fix off-by-one error in loop handling dots
...
Fixes an error where a loop, used to traverse an array of length `n`,
ran `n + 1` times instead of `n`.
PR-URL: https://github.com/nodejs/node/pull/8420
Reviewed-By: Brian White <mscdex@mscdex.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com >
2016-09-11 21:16:17 -07:00
Ilkka Myller
51f96dfcfc
url: keep auth in url.resolve() if host matches
...
Fixes: https://github.com/nodejs/node/issues/8165
PR-URL: https://github.com/nodejs/node/pull/8215
Reviewed-By: James M Snell <jasnell@gmail.com >
2016-08-24 11:40:14 -07:00
Ilkka Myller
286d44e43d
url: fix inconsistent port in url.resolveObject
...
This commit fixes bug where url.resolveObject returns conflicting
host and port values.
Fixes: https://github.com/nodejs/node/issues/8213
PR-URL: https://github.com/nodejs/node/pull/8214
Reviewed-By: James M Snell <jasnell@gmail.com >
2016-08-23 12:44:00 -07:00
Ilkka Myller
1d0385f62d
url: url.format() encodes all # in search
...
This commit fixes an error where only the first occurrence of `#` in
`search` parameter is URL encoded, and subsequent occurrences are not.
Also added a test for the case.
Fixes: https://github.com/nodejs/node/issues/8064
PR-URL: https://github.com/nodejs/node/pull/8072
Reviewed-By: James M Snell <jasnell@gmail.com >
2016-08-18 11:21:19 -07:00
James M Snell
7de59ef925
net: use icu's punycode implementation
...
ICU has a punycode implementation built in. Use it instead of the
javascript implementation because it's much faster.
PR-URL: https://github.com/nodejs/node/pull/7355
Reviewed-By: Trevor Norris <trev.norris@gmail.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
2016-06-29 17:10:53 -07:00
Rich Trott
336b027411
url: return valid file: urls fom url.format()
...
`file:` URLs that do not start with `file://` are invalid. Browsers
convert `file:/etc/passwd` to `file:///etc/passwd`. This is also what
the docs indicate we are doing, but we're not.
PR-URL: https://github.com/nodejs/node/pull/7234
Fixes: https://github.com/nodejs/node/issues/3361
Reviewed-By: Roman Reiss <me@silverwind.io >
Reviewed-By: Brian White <mscdex@mscdex.net >
2016-06-16 13:40:20 -07:00
Alex Kocharin
eb4201f07a
url: drop auth in url.resolve() if host changes
...
Fixes: https://github.com/nodejs/node/issues/1435
PR-URL: https://github.com/nodejs/node/pull/1480
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Brian White <mscdex@mscdex.net >
2016-04-25 10:39:10 -07:00
Brian White
e9dc6306ca
url: use "empty" object for empty query strings
...
This makes things consistent with the way that the querystring
module creates parsed results.
PR-URL: https://github.com/nodejs/node/pull/6289
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Michaël Zasso <mic.besace@gmail.com >
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com >
Reviewed-By: Minwoo Jung <jmwsoft@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2016-04-20 08:26:06 -07:00
nettofarah
610bd8d567
url: group slashed protocols by protocol name
...
Reorder slashed protocols so they are grouped by protocol name. This is
done so it doesn't look like we're duplicating protocol names at the
bottom of the list.
PR-URL: https://github.com/nodejs/node/pull/5380
Reviewed-By: Evan Lucas <evanlucas@me.com >
2016-02-29 20:26:59 -06:00
Brian White
8b16ba3bbf
url: fix off-by-one error with parse()
...
Fixes: https://github.com/nodejs/node/issues/5393
PR-URL: https://github.com/nodejs/node/pull/5394
Reviewed-By: Myles Borins <myles.borins@gmail.com >
Reviewed-By: Roman Reiss <me@silverwind.io >
Reviewed-By: Rod Vagg <rod@vagg.org >
Reviewed-By: Evan Lucas <evanlucas@me.com >
2016-02-27 14:45:20 +01:00
Brian White
7d1d3a6621
url: fix lint and deopt issues
...
The deopt issues arose from the use of const in specific situations
that v8 does not fully support yet.
Fixes: https://github.com/nodejs/node/issues/5299
PR-URL: https://github.com/nodejs/node/pull/5300
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Evan Lucas <evanlucas@me.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2016-02-18 09:55:03 -08:00
Brian White
db9128135f
url: improve url.parse() performance
...
This commit improves url.parse() performance by 50-210%
with the existing url/url-parse benchmarks. Also, the
optimizations made in url.format() result in a 40%
increase in performance for url.resolve().
Some optimization strategies used in this commit include:
* Combining multiple searches on the same string into a
single loop
* Avoiding unnecessary string.split() and array.join()
* Minimizing creation of temporary strings
* Using a faster alternative to encodeURIComponent,
borrowed from the querystring module
PR-URL: https://github.com/nodejs/node/pull/4892
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ryan Graham <r.m.graham@gmail.com >
Reviewed-By: Johan Bergström <bugs@bergstroem.nu >
2016-02-18 07:58:21 -05: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
Michaël Zasso
7ce0e04f44
lib: fix style issues after eslint update
...
With an indentation style of two spaces, it is not possible to indent
multiline variable declarations by four spaces. Instead, the var keyword
is used on every new line.
Use const instead of var where applicable for changed lines.
PR-URL: https://github.com/nodejs/io.js/pull/2286
Reviewed-By: Roman Reiss <me@silverwind.io >
2016-01-13 23:16:05 +01:00
Nik Nyby
46eee3018b
doc: fix spelling error in lib/url.js comment
...
PR-URL: https://github.com/nodejs/node/pull/4390
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com >
Reviewed-By: Myles Borins <myles.borins@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2015-12-30 12:01:47 -08:00
micnic
20285ad177
lib: Consistent error messages in all modules
...
This commit fixes some error messages that are not consistent with
some general rules which most of the error messages follow.
PR-URL: https://github.com/nodejs/node/pull/3374
Reviewed-By: Roman Reiss <me@silverwind.io >
2015-11-09 20:08:36 +01:00
James M Snell
936c9ffb0f
doc: multiple documentation updates cherry picked from v0.12
...
* doc: improve http.abort description
* doc: mention that mode is ignored if file exists
* docs: Fix default options for fs.createWriteStream()
* Documentation update about Buffer initialization
* doc: add a note about readable in flowing mode
* doc: Document http.request protocol option
* doc, comments: Grammar and spelling fixes
* updated documentation for fs.createReadStream
* Update child_process.markdown, spelling
* doc: Clarified read method with specified size argument.
* docs:events clarify emitter.listener() behavior
* doc: two minor stream doc improvements
* doc: clarify Readable._read and Readable.push
* doc: stream.unshift does not reset reading state
* doc: readable event clarification
* doc: additional refinement to readable event
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ben Noorduis <ben@strongloop.com >
PR-URL: https://github.com/nodejs/io.js/pull/2302
2015-08-05 08:44:55 -07:00