Commit c66f8c21 authored by Nathan Woltman's avatar Nathan Woltman Committed by Julien Gilli
Browse files

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

Reviewed-By: default avatarJulien Gilli <julien.gilli@joyent.com>
PR-URL: https://github.com/joyent/node/pull/9289
parent a0ce9cc3
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment