Skip to content
This repository has been archived by the owner on May 15, 2019. It is now read-only.

Commit

Permalink
Fixes #110
Browse files Browse the repository at this point in the history
  • Loading branch information
jmdobry committed Jun 16, 2017
1 parent f63ad18 commit 0a04d24
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
9 changes: 6 additions & 3 deletions src/cli/commands/deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ function calculateTimeout (timeout) {
}

if (typeof timeout === 'string') {
let matches;
if (matches = timeout.match(/^(\d+)s$/)) { // eslint-disable-line
let matches = timeout.match(/^(\d+)s$/);
if (matches && matches[1] && typeof matches[1] === 'string') {
const timeout = parseFloat(matches[1]);
if (!isNaN(timeout)) {
if (timeout > MAX.seconds) {
Expand All @@ -189,7 +189,10 @@ function calculateTimeout (timeout) {
}
return { seconds: timeout };
}
} else if (matches = timeout.match(/^(\d+)ms$/)) { // eslint-disable-line
}

matches = timeout.match(/^(\d+)ms$/);
if (matches && matches[1] && typeof matches[1] === 'string') {
const timeout = parseFloat(matches[1]) / 1000;
if (!isNaN(timeout)) {
if (timeout > MAX.seconds) {
Expand Down
10 changes: 5 additions & 5 deletions src/model/cloudfunction.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,8 @@ class CloudFunction {
static parseLocation (location = '') {
const matches = location.match(CloudFunction.LOCATION_REG_EXP);
return {
project: matches[1],
location: matches[2]
project: matches ? matches[1] : null,
location: matches ? matches[2] : null
};
}

Expand All @@ -230,9 +230,9 @@ class CloudFunction {
static parseName (name = '') {
const matches = name.match(CloudFunction.NAME_REG_EXP);
return {
project: matches[1],
location: matches[2],
name: matches[3]
project: matches ? matches[1] : null,
location: matches ? matches[2] : null,
name: matches ? matches[3] : null
};
}

Expand Down
2 changes: 1 addition & 1 deletion src/model/operation.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ class Operation {
static parseName (name = '') {
const matches = name.match(Operation.NAME_REG_EXP);
return {
operation: matches[1]
operation: matches ? matches[1] : null
};
}

Expand Down

0 comments on commit 0a04d24

Please sign in to comment.