Skip to content

Commit 96e3dd0

Browse files
author
Frank Schmid
committed
Fixed ESLint errors
1 parent 4a7a23d commit 96e3dd0

File tree

2 files changed

+18
-19
lines changed

2 files changed

+18
-19
lines changed

lib/logs.js

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,14 @@ module.exports = {
4444
this.options.stage,
4545
this.options.region)
4646
.then(reply => {
47-
if (!reply || reply.logStreams.length === 0) {
47+
if (!reply || _.isEmpty(reply.logStreams)) {
4848
throw new this.serverless.classes
4949
.Error('No existing streams for the function alias');
5050
}
5151

52-
return _.chain(reply.logStreams)
53-
.filter(stream => _.includes(stream.logStreamName, `[${version}]`))
54-
.map('logStreamName')
55-
.value();
52+
return _.map(
53+
_.filter(reply.logStreams, stream => _.includes(stream.logStreamName, `[${version}]`)),
54+
stream => stream.logStreamName);
5655
});
5756
});
5857

@@ -71,24 +70,24 @@ module.exports = {
7170
let msg = msgParam;
7271
const dateFormat = 'YYYY-MM-DD HH:mm:ss.SSS (Z)';
7372

74-
if (msg.startsWith('REPORT')) {
73+
if (_.startsWith(msg, 'REPORT')) {
7574
msg += os.EOL;
7675
}
7776

78-
if (msg.startsWith('START') || msg.startsWith('END') || msg.startsWith('REPORT')) {
77+
if (_.startsWith(msg, 'START') || _.startsWith(msg, 'END') || _.startsWith(msg, 'REPORT')) {
7978
return chalk.gray(msg);
80-
} else if (msg.trim() === 'Process exited before completing request') {
79+
} else if (_.trim(msg) === 'Process exited before completing request') {
8180
return chalk.red(msg);
8281
}
8382

84-
const splitted = msg.split('\t');
83+
const splitted = _.split(msg, '\t');
8584

8685
if (splitted.length < 3 || new Date(splitted[0]) === 'Invalid Date') {
8786
return msg;
8887
}
8988
const reqId = splitted[1];
9089
const time = chalk.green(moment(splitted[0]).format(dateFormat));
91-
const text = msg.split(`${reqId}\t`)[1];
90+
const text = _.split(msg, `${reqId}\t`)[1];
9291

9392
return `${time}\t${chalk.yellow(reqId)}\t${text}`;
9493
};
@@ -103,12 +102,12 @@ module.exports = {
103102
if (this.options.filter) params.filterPattern = this.options.filter;
104103
if (this.options.nextToken) params.nextToken = this.options.nextToken;
105104
if (this.options.startTime) {
106-
const since = (['m', 'h', 'd']
107-
.indexOf(this.options.startTime[this.options.startTime.length - 1]) !== -1);
105+
const since = _.includes(['m', 'h', 'd'],
106+
this.options.startTime[this.options.startTime.length - 1]);
108107
if (since) {
109-
params.startTime = moment().subtract(this.options
110-
.startTime.replace(/\D/g, ''), this.options
111-
.startTime.replace(/\d/g, '')).valueOf();
108+
params.startTime = moment().subtract(
109+
_.replace(this.options.startTime, /\D/g, ''),
110+
_.replace(this.options.startTime, /\d/g, '')).valueOf();
112111
} else {
113112
params.startTime = moment.utc(this.options.startTime).valueOf();
114113
}
@@ -122,7 +121,7 @@ module.exports = {
122121
this.options.region)
123122
.then(results => {
124123
if (results.events) {
125-
results.events.forEach(e => {
124+
_.forEach(results.events, e => {
126125
process.stdout.write(formatLambdaLogEvent(e.message));
127126
});
128127
}

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@
4545
"eslint-plugin-promise": "^3.4.0",
4646
"get-installed-path": "^2.0.3",
4747
"istanbul": "^0.4.5",
48-
"mocha": "^3.3.0",
49-
"serverless": "^1.12.1",
50-
"sinon": "^2.2.0",
48+
"mocha": "^3.4.1",
49+
"serverless": "^1.13.2",
50+
"sinon": "^2.3.1",
5151
"sinon-chai": "^2.10.0"
5252
}
5353
}

0 commit comments

Comments
 (0)