mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 21:58:48 +02:00
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>
This commit is contained in:
parent
803883bb1a
commit
804e7aa9ab
48 changed files with 392 additions and 405 deletions
10
lib/path.js
10
lib/path.js
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
var isWindows = process.platform === 'win32';
|
||||
var util = require('util');
|
||||
const isWindows = process.platform === 'win32';
|
||||
const util = require('util');
|
||||
|
||||
|
||||
// resolves . and .. elements in a path array with directory names there
|
||||
|
@ -33,11 +33,11 @@ function normalizeArray(parts, allowAboveRoot) {
|
|||
|
||||
// Regex to split a windows path into three parts: [*, device, slash,
|
||||
// tail] windows-only
|
||||
var splitDeviceRe =
|
||||
const splitDeviceRe =
|
||||
/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/;
|
||||
|
||||
// Regex to split the tail part of the above into [*, dir, basename, ext]
|
||||
var splitTailRe =
|
||||
const splitTailRe =
|
||||
/^([\s\S]*?)((?:\.{1,2}|[^\\\/]+?|)(\.[^.\/\\]*|))(?:[\\\/]*)$/;
|
||||
|
||||
var win32 = {};
|
||||
|
@ -378,7 +378,7 @@ win32.delimiter = ';';
|
|||
|
||||
// Split a filename into [root, dir, basename, ext], unix version
|
||||
// 'root' is just a slash, or nothing.
|
||||
var splitPathRe =
|
||||
const splitPathRe =
|
||||
/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;
|
||||
var posix = {};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue