Skip to content

Commit

Permalink
Corrected lint errors in normalizer code 👕
Browse files Browse the repository at this point in the history
  • Loading branch information
kunagpal committed Jul 16, 2018
1 parent 759d63b commit 9cdd036
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions lib/normalizers/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable object-shorthand */
var semver = require('semver'),

// @todo: Add support for more normalizers
Expand Down
12 changes: 9 additions & 3 deletions lib/normalizers/v1.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
/* eslint-disable object-shorthand */
var _ = require('lodash').noConflict(),
v1Common = require('../common/v1'),
v2Common = require('../common/v2'),
util = require('../util'),
url = require('../url'),

Builders = function ConverterBuilder (options) {
Builders = function (options) {
this.options = options || {};
},
script = function (entityV1, listen, key) {
Expand Down Expand Up @@ -148,10 +149,12 @@ _.assign(Builders.prototype, {
if (!requestV1) { return; }

var mode = requestV1.dataMode;

if ((!mode || mode === 'binary') && !this.options.noDefaults) { return []; }
if (!requestV1.data) { return; }

_.isArray(requestV1.data) && normalizeEntities(requestV1.data, this.options);

return requestV1.data;
},

Expand Down Expand Up @@ -277,7 +280,9 @@ _.assign(Builders.prototype, {
requestV1.currentHelper = v2Common.authMap[requestV1.auth.type];
(requestV1.currentHelper === null) && (requestV1.helperAttributes = null);

if (mapper = util.authMappersFromCurrent[requestV1.currentHelper]) {
mapper = util.authMappersFromCurrent[requestV1.currentHelper];

if (mapper) {
(map = util.authArrayToMap(requestV1)) && (helperAttributes = mapper(map[requestV1.auth.type]));
helperAttributes && (requestV1.helperAttributes = helperAttributes);
}
Expand Down Expand Up @@ -415,7 +420,7 @@ _.assign(Builders.prototype, {
* Normalizes a potentially raw v1 request object.
*
* @param {Object} collectionV1 - The potentially raw v1 collection object.
* @returns {Object[]} - The normalized v1 request list.
* @returns {Object[]|*} - The normalized v1 request list.
*/
requests: function (collectionV1) {
if (_.isEmpty(collectionV1 && collectionV1.requests)) { return; }
Expand Down Expand Up @@ -545,6 +550,7 @@ module.exports = {
}

if (callback) { return callback(null, collection); }

return collection;
}
};

0 comments on commit 9cdd036

Please sign in to comment.