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

118 Commits

Author SHA1 Message Date
Ruben Bridgewater
c6b6c92185
lib: always show ERR_INVALID_ARG_TYPE received part
This makes a effort to make sure all of these errors will actually
also show the received input.
On top of that it refactors a few tests for better maintainability.
It will also change the returned type to always be a simple typeof
instead of special handling null.

PR-URL: https://github.com/nodejs/node/pull/19445
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2018-03-25 01:45:37 +01:00
Michaël Zasso
a0adf56855 path: fix regression in posix.normalize
Fixes a regression introduced in [1].
The posix version of normalize should not treat backslash as a path
separator.

[1] https://github.com/nodejs/node/commit/4ae320f2

PR-URL: https://github.com/nodejs/node/pull/19520
Fixes: https://github.com/nodejs/node/issues/19519
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2018-03-23 19:47:11 +01:00
Sergey Golovin
4ae320f2b3 path: remove redundant function
PR-URL: https://github.com/nodejs/node/pull/19237
Reviewed-By: Weijia Wang <starkwang@126.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2018-03-14 22:04:00 +08:00
Michaël Zasso
1e8d110e64 lib: port errors to new system
This is a first batch of updates that touches non-underscored modules in
lib.

PR-URL: https://github.com/nodejs/node/pull/19034
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2018-03-05 19:51:30 +01:00
Sergey Golovin
b404aa56c0
path: replace duplicate conditions by functions
It will also remove useless "code" variables by inlining
path.charCodeAt.

PR-URL: https://github.com/nodejs/node/pull/18693
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Jon Moss <me@jonathanmoss.me>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2018-02-17 14:53:58 +01:00
Sergey Golovin
6abce37f34
path: replace "magic" numbers by readable constants
PR-URL: https://github.com/nodejs/node/pull/18654
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Kyle Farnung <kfarnung@microsoft.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2018-02-12 20:12:40 +01:00
Weijia Wang
315d1f553d path: fix path.normalize for relative paths
After slicing, the `lastSegmentLength` should be calculated again,
instead of assigning value `j`.

PR-URL: https://github.com/nodejs/node/pull/17974
Fixes: https://github.com/nodejs/node/issues/17928
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
2018-01-11 11:11:22 +08:00
薛定谔的猫
fbb9eef4c4 benchmark,path: remove unused variables
PR-URL: https://github.com/nodejs/node/pull/15789
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2017-11-22 14:36:38 -08:00
Rich Trott
886c5f47e1
path: remove obsolete comment
Remove commented-out code that is leftover from a refactoring.

PR-URL: https://github.com/nodejs/node/pull/17023
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Lance Ball <lball@redhat.com>
2017-11-16 16:30:01 -05: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
James M Snell
1261b94a3f doc: fix unassigned deprecation code
Forgot to assign the deprecation code when landing
1f8d527e94

PR-URL: https://github.com/nodejs/node/pull/15741
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2017-10-02 19:09:05 -07:00
James M Snell
1f8d527e94 path: deprecate internal _makeLong, replace
Replace the internal `path._makeLong()` with a public
`path.toLongUNCPath()` method. Add documentation.

PR-URL: https://github.com/nodejs/node/pull/14956
Ref: https://github.com/standard-things/esm/issues/66
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2017-10-02 11:30:19 -07:00
Michaël Zasso
cfee1c9778 path: fix normalize paths ending with two dots
Fixes: https://github.com/nodejs/security/issues/147
PR-URL: https://github.com/nodejs-private/node-private/pull/94
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Doug Wilson <doug@somethingdoug.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
2017-09-26 14:59:54 -07:00
Michaël Zasso
b98e8d995e path: fix normalize on directories with two dots
PR-URL: https://github.com/nodejs/node/pull/14107
Fixes: https://github.com/nodejs/node/issues/14105
Reviewed-By: Refael Ackermann <refack@gmail.com>
2017-08-30 14:44:55 +02:00
Timothy Gu
2791761eda
path: fix win32 volume-relative paths
`path.resolve()` and `path.join()` are left alone in this commit due to
the lack of clear semantics.

PR-URL: https://github.com/nodejs/node/pull/14440
Fixes: https://github.com/nodejs/node/issues/14405
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2017-07-30 19:24:23 +08:00
Tobias Nießen
2ac0aff283 path: remove unnecessary string copies
As the length of `path` is known at this point, there is no point in
making an exact copy using `slice`.

PR-URL: https://github.com/nodejs/node/pull/14438
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Khaidi Chu <i@2333.moe>
2017-07-26 13:49:25 +02:00
Tobias Nießen
44256bb0aa path: fix incorrect use of ERR_INVALID_ARG_TYPE
PR-URL: https://github.com/nodejs/node/pull/14011
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-07-03 16:28:02 +02:00
Sebastian Van Sande
dcfbbacba8 path: use internal/errors.js
PR-URL: https://github.com/nodejs/node/pull/11319
Ref: https://github.com/nodejs/node/issues/11273
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
2017-06-06 17:20:23 -04: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
Jason Ginchereau
0f2f8efdde path: fallback to process cwd when resolving drive cwd
The `path.resolve()` function when given just a drive letter such as
"C:" tries to get a drive-specific CWD, but that isn't available in
cases when the process is not launched via cmd.exe and the process
CWD has not been explicitly set on that drive.

This change adds a fallback to the process CWD, if the process CWD
happens to be on the resolved drive letter. If the process CWD is on
another drive, then a drive-specific CWD cannot be resolved and
defaults to the drive's root as before.

Based on experimentation, the fixed behavior matches that of other
similar path resolution implementations on Windows I checked: .NET's
`System.IO.Path.GetFullPath()` and Python's `os.path.abspath()`.

In the automated path test cases the issue doesn't occur when the
tests are run normally from cmd.exe. But it did cause an assertion
when running the tests from PowerShell, that is fixed by this change.

PR-URL: https://github.com/nodejs/node/pull/8541
Fixes: https://github.com/nodejs/node/issues/7215
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-09-24 01:14:56 +03:00
Jason Ginchereau
c1e47ed8c8 path: fix path.relative UNC path result
When the result of a path.relative() is an absolute UNC path, it should
include the leading backslashes.

Fixes: https://github.com/nodejs/node/issues/8444
PR-URL: https://github.com/nodejs/node/pull/8523
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
2016-09-20 09:56:50 -07:00
Brian White
dfaa9c9055
path: fix basename() regressions
This commit fixes a regression in basename() for the case when a
supplied extension name completely matches the resulting basename.

Fixes: https://github.com/nodejs/node/issues/6587
PR-URL: https://github.com/nodejs/node/pull/6590
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
2016-05-18 02:12:28 -04:00
Rich Trott
a56da51a38 benchmark,test,lib: remove extra spaces
In preparation for stricter linting, remove extra spaces.

PR-URL: https://github.com/nodejs/node/pull/6645
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Roman Reiss <me@silverwind.io>
2016-05-11 23:18:16 -07:00
Brian White
3072546feb path: fix win32.isAbsolute() inconsistency
This commit fixes an inconsistency in absolute path checking compared
to the absolute path detection used by the other path.win32 functions.

Fixes: https://github.com/nodejs/node/issues/6027
PR-URL: https://github.com/nodejs/node/pull/6028
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-04-04 14:45:22 -07:00
Brian White
08085c49b6 path: assert inputs are strings
This commit makes input type checking consistent across all path
functions.

PR-URL: https://github.com/nodejs/node/pull/5348
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
2016-03-17 23:20:12 -04:00
Rich Trott
9de9a08587 path: refactor path.format() repeated code
PR-URL: https://github.com/nodejs/node/pull/5673
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James Snell <jasnell@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
2016-03-16 10:19:41 -07:00
Evan Lucas
3d3b45ae95 path: fix normalize for absolutes
Fixes a regression introduced by
b212be08f6.

path.normalize(''/a/b/c/../../../x/y/z'') should return '/x/y/z'.

Fixes: https://github.com/nodejs/node/issues/5585
PR-URL: https://github.com/nodejs/node/pull/5589
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
2016-03-07 14:48:49 -06:00
Owen Smith
f296a7f16f path: fix path.relative() for prefixes at root
Fixes #5485

PR-URL: https://github.com/nodejs/node/pull/5490
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Brian White <mscdex@mscdex.net>
2016-02-29 20:10:04 +01:00
Zheng Chaoping
4717ea9186 path: fix win32 parse()
Fix path.win32.parse("/foo/bar") retuns `{root: '' ...}`(v5.7.0),
but not `{root: '/' ...}`(v5.6.0).

PR-URL: https://github.com/nodejs/node/pull/5484
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Roman Reiss <me@silverwind.io>
2016-02-29 19:39:56 +01:00
Owen Smith
e326950498 path: fix win32 relative() for UNC paths
win32 normalize() will output a trailing '\' for some UNC paths. trim
them before processing

Change by @mscdex

Add basic UNC path tests to win32 relative()

PR-URL: https://github.com/nodejs/node/pull/5456
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Roman Reiss <me@silverwind.io>
2016-02-27 17:30:44 +01:00
Owen Smith
b33879d9e2 path: fix win32 relative() when "to" is a prefix
when the basename of "to" was a prefix of the basename of "from" win32
relative() would miss including it in the result

Fixes: https://github.com/nodejs/node/issues/5447
PR-URL: https://github.com/nodejs/node/pull/5456
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Roman Reiss <me@silverwind.io>
2016-02-27 17:29:29 +01:00
Brian White
3a331b66f8 path: fix verbose relative() output
Fixes: https://github.com/nodejs/node/issues/5383
PR-URL: https://github.com/nodejs/node/pull/5389
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:42:33 +01:00
Brian White
9209bf6d43 path: fix input type checking regression
Before b212be08f6, input types were not checked in some path functions
and the inputs were passed directly to `regexp.exec()` which
implicitly converts its argument to a string.

This commit both removes the type checking added in b212be08f6 and
adds string coercion for those functions.

PR-URL: https://github.com/nodejs/node/pull/5244
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Rod Vagg <rod@vagg.org>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
2016-02-17 14:18:43 -05:00
Brian White
b212be08f6 path: performance improvements on all platforms
This commit significantly improves performance of all path functions.

Optimization strategies include:
* Replacing regexps with manual parsers
* Avoiding unnecessary array creation (including split() + join())
* Returning earlier where possible to avoid unnecessary work
* Minimize unnecessary string creation and concatenations
* Combining string iterations

PR-URL: https://github.com/nodejs/node/pull/5123
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-02-09 20:35:46 -08:00
Rich Trott
089d84f8fa lib: scope loop variables
Refactor instances in `lib` where a loop variable is redeclared in the
same scope with `var`. In these cases, `let` can be used to scope the
variable declarations more precisely.

PR-URL: https://github.com/nodejs/node/pull/4965
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-02-01 09:28:38 -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
Nathan Woltman
d1000b4137 path: make format() consistent and more functional
Make the win32 and posix versions of path.format() consistent in when
they add a directory separator between the dir and base parts of the
path (always add it unless the dir part is the same as the root).

Also, path.format() is now more functional in that it uses the name
and ext parts of the path if the base part is left out and it uses
the root part if the dir part is left out.

Reviewed-By: João Reis <reis@janeasystems.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/2408
2015-11-27 11:53:33 +00:00
cjihrig
2c33819370 test: fix tests that check error messages
20285ad177 changed the format
of error messages throughout lib. However, the tests were not
updated to reflect these changes. This commit makes those
changes.

PR-URL: https://github.com/nodejs/node/pull/3727
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Reviewed-By: James M Snell <jasnell@gmail.com>
2015-11-10 07:12:33 +01: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
Evan Lucas
b50e89e01f path: improve posixSplitPath performance
Instead of slicing the first element off of the matches, shift and then
return. This improves performance of the following path functions:

- basename: 18-20%
- extname: 60-70%
- dirname: 18-20%
- parse: 20-25%

PR-URL: https://github.com/nodejs/node/pull/3034
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
2015-09-25 08:28:26 -05:00
Sam Stites
1a3b295d0f path: use '===' instead of '==' for comparison
Per: https://github.com/joyent/node/pull/7554

Originally submitted by @stites

PR-URL: https://github.com/nodejs/node/pull/2388
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
2015-08-17 20:47:41 +02:00
Nathan Woltman
2db57bdecc path: remove dead code in favor of unit tests
Remove dead code paths that are created by assertions that will never
trigger. They may only trigger if either the `splitDeviceRe` or
`splitPathRe` regular expressions are modified. If at some point they
are modified, current unit tests will catch most of the resulting
errors and this commit adds extra tests to catch the remaining errors.

PR-URL: https://github.com/nodejs/io.js/pull/2282
Reviewed-By: Roman Reiss <me@silverwind.io>
2015-08-09 12:29:01 +02:00
Phillip Johnsen
2ba84606a6 path: assert path.join() arguments equally
Re-use `assertPath()` when asserting path argument types in `join()`
as throughout the rest of the `path` module.

This also ensures the same error message generated for posix as for
win32.

PR-URL: https://github.com/nodejs/io.js/pull/2159
Reviewed-By: Roman Reiss <me@silverwind.io>
2015-07-12 01:05:05 +02:00
Nathan Woltman
bca53dce76 path: refactor for performance and consistency
Improve performance by:
+ Not leaking the `arguments` object!
+ Getting the last character of a string by index, instead of
  with `.substr()` or `.slice()`

Improve code consistency by:
+ Using `[]` instead of `.charAt()` where possible
+ Using a function declaration instead of a var declaration
+ Using `.slice()` with clearer arguments
+ Checking if `dir` is truthy in `win32.format`
  (added tests for this)

Improve both by:
+ Making the reusable `trimArray()` function
+ Standardizing getting certain path statistics with
  the new `win32StatPath()` function

PR-URL: https://github.com/nodejs/io.js/pull/1778
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
2015-07-04 13:24:59 +02:00
cjihrig
8de78e470d path: reduce type checking on some methods
a465840313 added strict type
checking for the methods in the path module. However, dirname(),
basename(), and extname() actually had some undocumented uses
in the wild. This commit loosens the type checking on those
methods.

Fixes: https://github.com/iojs/io.js/issues/1215
PR-URL: https://github.com/iojs/io.js/pull/1216
Reviewed-By: Rod Vagg <rod@vagg.org>
2015-03-19 21:11:12 -04:00
cjihrig
eb995d6822 path: add type checking for path inputs
This commit adds type checking of path inputs to exported methods
in the path module. The exception is _makeLong(), which seems to
explicitly support any data type.

Fixes: https://github.com/iojs/io.js/issues/1139
PR-URL: https://github.com/iojs/io.js/pull/1153
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Brendan Ashworth <brendan.ashworth@me.com>
2015-03-16 12:49:21 -04:00
cjihrig
6ac8bdc0ab lib: reduce util.is*() usage
Many of the util.is*() methods used to check data types
simply compare against a single value or the result of
typeof. This commit replaces calls to these methods with
equivalent checks. This commit does not touch calls to the
more complex methods (isRegExp(), isDate(), etc.).

Fixes: https://github.com/iojs/io.js/issues/607
PR-URL: https://github.com/iojs/io.js/pull/647
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-01-31 23:47:29 -05:00
cjihrig
804e7aa9ab lib: use const to define constants
This commit replaces a number of var statements throughout
the lib code with const statements.

PR-URL: https://github.com/iojs/io.js/pull/541
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-01-21 16:21:31 -05:00
isaacs
3e1b1dd4a9 Remove excessive copyright/license boilerplate
The copyright and license notice is already in the LICENSE file.  There
is no justifiable reason to also require that it be included in every
file, since the individual files are not individually distributed except
as part of the entire package.
2015-01-12 15:30:28 -08:00
Nathan Woltman
50d7401244 path: refactor normalizeArray()
The normalizeArray() function now avoids using the slow Array#splice()
method to improve performance and now also filters out empty path parts.

Code that pre-filtered empty parts has been removed.

PR-URL: https://github.com/joyent/node/pull/8724
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
2014-12-09 17:57:09 +01:00