Skip to content

Commit

Permalink
style: please the linter
Browse files Browse the repository at this point in the history
  • Loading branch information
Xiphe committed Jun 16, 2016
1 parent c96038d commit 15e7565
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 23 deletions.
4 changes: 2 additions & 2 deletions lib/MultiTypeValue.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class MultiTypeValue {
return;
} else if (type(this.originalValue) === toType) {
this.value = this.originalValue;
} else if(this[convertMethod]) {
} else if (this[convertMethod]) {
this.value = this[convertMethod](this.originalValue);
}
}
Expand All @@ -64,7 +64,7 @@ MultiTypeValue.prototype.falsyStrings = [
'null',
'false',
'NaN',
'undefined'
'undefined',
];

MultiTypeValue.prototype.arrayDelmiter = ',';
Expand Down
29 changes: 14 additions & 15 deletions lib/Uberconfig.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-underscore-dangle */
'use strict';

const type = require('useful-type');
Expand All @@ -10,7 +11,7 @@ const DEFAULTS = {
envPrefix: 'UBERCONFIG_',
envConverter: getFromEnv.converter,
cliPrefix: 'uc-',
cliConverter: getFromCliArg.converter
cliConverter: getFromCliArg.converter,
};

class Uberconfig {
Expand All @@ -22,17 +23,15 @@ class Uberconfig {
request(requests, conflictResolver) {
const response = {};

for (const key in requests) {
if (requests.hasOwnProperty(key)) {
const request = requests[key];
Object.keys(requests).forEach(key => {
const request = requests[key];

response[request.as || key] = this.get(
key,
request.default,
request.conflictResolver || conflictResolver
);
}
}
response[request.as || key] = this.get(
key,
request.default,
request.conflictResolver || conflictResolver
);
});

return dot.object(response);
}
Expand All @@ -43,9 +42,9 @@ class Uberconfig {

return getValue(
[
() => {return getFromCliArg(key, this._opt);},
() => {return getFromEnv(key, this._opt);},
() => {return dot.pick(key, this.config);}
() => getFromCliArg(key, this._opt),
() => getFromEnv(key, this._opt),
() => dot.pick(key, this.config),
].reduce((aValue, getter) => {
if (aValue === null) {
return getter();
Expand All @@ -55,7 +54,7 @@ class Uberconfig {
}, null),
getDefault(
this._defaultsMap,
{defaultValue, conflictResolver},
{ defaultValue, conflictResolver },
key
),
key
Expand Down
6 changes: 3 additions & 3 deletions lib/getDefault.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ function resolveConflict(defaultsMap, newDefault, key) {
`to equal ${JSON.stringify(otherDefaultValues[0])}`);
}

return getDefaultValue(
return getDefaultValue( // eslint-disable-line no-use-before-define
defaultsMap,
{
defaultValue: newDefault.conflictResolver(
newDefault,
defaultsMap[key],
key
).defaultValue
).defaultValue,
},
key
);
Expand All @@ -55,7 +55,7 @@ function getDefaultValue(defaultsMap, newDefault, key) {
return resolveConflict(defaultsMap, newDefault, key);
}
} else {
defaultsMap[key] = [];
defaultsMap[key] = []; // eslint-disable-line no-param-reassign
}

defaultsMap[key].push(newDefault);
Expand Down
1 change: 0 additions & 1 deletion lib/getFromCliArg.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint no-process-env: [0] */
'use strict';

const MultiTypeValue = require('./MultiTypeValue');
Expand Down
1 change: 0 additions & 1 deletion lib/getFromEnv.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint no-process-env: [0] */
'use strict';

const MultiTypeValue = require('./MultiTypeValue');
Expand Down
2 changes: 1 addition & 1 deletion lib/getValue.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const type = require('useful-type');
const MultiTypeValue = require('./MultiTypeValue');

module.exports = function getValue(aValue, defaultValue, key) {
var value = aValue;
let value = aValue;

if (type(value) === 'undefined') {
return defaultValue;
Expand Down

0 comments on commit 15e7565

Please sign in to comment.