From 4ea88dbf807dd082587e57a274f7ad0a9869cef9 Mon Sep 17 00:00:00 2001 From: oroce Date: Thu, 20 Apr 2017 12:01:46 +0200 Subject: [PATCH] style: use const everywhere --- darwin.js | 4 ++-- darwin.spec.js | 2 +- index.spec.js | 6 +++--- linux.js | 2 +- linux.spec.js | 2 +- win32.js | 10 +++++----- win32.spec.js | 2 +- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/darwin.js b/darwin.js index 99a94fc..71391a8 100644 --- a/darwin.js +++ b/darwin.js @@ -2,8 +2,8 @@ const execSync = require('child_process').execSync; module.exports = () => { - let output = execSync('sysctl -n kern.boottime').toString(), - date = output.replace(/{[ ,=\w]+} /g, '').trim(); + const output = execSync('sysctl -n kern.boottime').toString(); + const date = output.replace(/{[ ,=\w]+} /g, '').trim(); return new Date(date); }; diff --git a/darwin.spec.js b/darwin.spec.js index e422682..996a48d 100644 --- a/darwin.spec.js +++ b/darwin.spec.js @@ -4,7 +4,7 @@ const assert = require('assert'); describe('darwin', () => { it('should parse the date', () => { - let darwin = proxyquire('./darwin', { + const darwin = proxyquire('./darwin', { 'child_process': { execSync: (cmd) => { assert.equal(cmd, 'sysctl -n kern.boottime', 'should call sysctl command'); diff --git a/index.spec.js b/index.spec.js index 14a98d9..b2fc82a 100644 --- a/index.spec.js +++ b/index.spec.js @@ -16,7 +16,7 @@ describe('index', function () { }); it('should require darwin', function () { - let uptime = proxyquire('./index', { + const uptime = proxyquire('./index', { './darwin': { type: 'darwin' }, @@ -38,7 +38,7 @@ describe('index', function () { }); it('should require linux', function () { - let uptime = proxyquire('./index', { + const uptime = proxyquire('./index', { './darwin': { type: 'darwin' }, @@ -60,7 +60,7 @@ describe('index', function () { }); it('should require win32', function () { - let uptime = proxyquire('./index', { + const uptime = proxyquire('./index', { './darwin': { type: 'darwin' }, diff --git a/linux.js b/linux.js index 6049615..c90986a 100644 --- a/linux.js +++ b/linux.js @@ -2,7 +2,7 @@ const execSync = require('child_process').execSync; module.exports = () => { - let output = execSync('uptime -s').toString(); + const output = execSync('uptime -s').toString(); return new Date(output); }; diff --git a/linux.spec.js b/linux.spec.js index 4864f57..4061255 100644 --- a/linux.spec.js +++ b/linux.spec.js @@ -4,7 +4,7 @@ const assert = require('assert'); describe('linux', () => { it('should parse the date', () => { - let linux = proxyquire('./linux', { + const linux = proxyquire('./linux', { 'child_process': { execSync: (cmd) => { assert.equal(cmd, 'uptime -s', 'should call uptime command'); diff --git a/win32.js b/win32.js index adb7951..b733899 100644 --- a/win32.js +++ b/win32.js @@ -2,11 +2,11 @@ const execSync = require('child_process').execSync; module.exports = () => { - let output = execSync('net statistics workstation').toString(), - date = output.match(/((\d{2}\.){2}\d{4}){1} ((\d{2}:){2}\d{2}){1}/gm), - split = date[0].split(' '), - format = split[0].split('.'), - formatedDate = `${format[1]}-${format[0]}-${format[2]} ${split[1]}`; + const output = execSync('net statistics workstation').toString(); + const date = output.match(/((\d{2}\.){2}\d{4}){1} ((\d{2}:){2}\d{2}){1}/gm); + const split = date[0].split(' '); + const format = split[0].split('.'); + const formatedDate = `${format[1]}-${format[0]}-${format[2]} ${split[1]}`; return new Date(formatedDate); }; diff --git a/win32.spec.js b/win32.spec.js index 9be7721..60fb8b4 100644 --- a/win32.spec.js +++ b/win32.spec.js @@ -4,7 +4,7 @@ const assert = require('assert'); describe('win32', () => { it('should parse the date', () => { - let win32 = proxyquire('./win32', { + const win32 = proxyquire('./win32', { 'child_process': { execSync: (cmd) => { assert.equal(cmd, 'net statistics workstation', 'should call net statistics workstation command');