Skip to content

Commit

Permalink
style: use const everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
oroce committed Apr 20, 2017
1 parent 14d044b commit 4ea88db
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions darwin.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
2 changes: 1 addition & 1 deletion darwin.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
6 changes: 3 additions & 3 deletions index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe('index', function () {
});

it('should require darwin', function () {
let uptime = proxyquire('./index', {
const uptime = proxyquire('./index', {
'./darwin': {
type: 'darwin'
},
Expand All @@ -38,7 +38,7 @@ describe('index', function () {
});

it('should require linux', function () {
let uptime = proxyquire('./index', {
const uptime = proxyquire('./index', {
'./darwin': {
type: 'darwin'
},
Expand All @@ -60,7 +60,7 @@ describe('index', function () {
});

it('should require win32', function () {
let uptime = proxyquire('./index', {
const uptime = proxyquire('./index', {
'./darwin': {
type: 'darwin'
},
Expand Down
2 changes: 1 addition & 1 deletion linux.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
2 changes: 1 addition & 1 deletion linux.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
10 changes: 5 additions & 5 deletions win32.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
2 changes: 1 addition & 1 deletion win32.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down

0 comments on commit 4ea88db

Please sign in to comment.