Skip to content

Commit

Permalink
Corrected lint errors in converter interface 👕
Browse files Browse the repository at this point in the history
  • Loading branch information
kunagpal committed Jul 16, 2018
1 parent 9c47c15 commit 1055c6d
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions lib/converters/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ var semver = require('semver'),
/**
* Prototype interface definition of a converter
*
* @param {object} model
* @param {string<semver>} model.input
* @param {string<semver>} model.output
* @param {function} model.convert
* @param {function} model.create
* @param {function=} [model.init]
* @param {Object} model - A manifest that defines the conversion process.
* @param {String} model.input - The input version to convert from.
* @param {String} model.output - The output version to convert to.
* @param {Function} model.convert - A function to convert entire collections.
* @param {Function} model.create - A function to perform creation operations.
* @param {Function} [model.init] - An initializer function to bootstrap the generated converter.
*
* @throws {Error} If model definition does not meet requirements
*/
Expand Down Expand Up @@ -66,9 +66,9 @@ module.exports = {
/**
* Fetches a converter for the given input and output versions
*
* @param inputVersion
* @param outputVersion
* @returns {Converter}
* @param {String} inputVersion - The version to convert from.
* @param {String} outputVersion - The version to convert to.
* @returns {Converter} - A converter for the given set of options.
*/
getConverter: function (inputVersion, outputVersion) {
var converter;
Expand All @@ -77,6 +77,7 @@ module.exports = {
outputVersion = semver.clean(outputVersion);

for (converter in this.converters) {
// eslint-disable-next-line no-prototype-builtins
converter = this.converters.hasOwnProperty(converter) && this.converters[converter];
if (converter && semver.eq(converter.input, inputVersion) && semver.eq(converter.output, outputVersion)) {
return generateConverter(converter);
Expand All @@ -87,27 +88,26 @@ module.exports = {
/**
* Picks the appropriate converter and converts the given collection.
*
* @param collection
* @param options
* @param callback
* @returns {*}
* @param {Object} collection - The collection to be converted.
* @param {Object} options - The set of options for request conversion.
* @param {Function} callback - The function to be invoked after the completion of conversion process.
*/
convert: function (collection, options, callback) {
var chosenConverter = this.getConverter(options.inputVersion, options.outputVersion);

if (!chosenConverter) {
return callback(new Error('no conversion path found'));
}

return chosenConverter.convert(collection, options, callback);
},

/**
* Picks the appropriate converter and converts the given object.
*
* @param object - A single V1 request or a V2 Item.
* @param options
* @param callback
* @returns {*}
* @param {Object} object - A single V1 request or a V2 Item.
* @param {Object} options - The set of options for request conversion.
* @param {Function} callback - The function to be invoked after the completion of conversion process.
*/
convertSingle: function (object, options, callback) {
var chosenConverter = this.getConverter(options.inputVersion, options.outputVersion);
Expand All @@ -122,9 +122,9 @@ module.exports = {
/**
* Picks the appropriate converter and converts the given object.
*
* @param object - A single V1 Response or a V2 Response.
* @param options
* @param callback
* @param {Object} object - A single V1 Response or a V2 Response.
* @param {Object} options - The set of options for response conversion.
* @param {Function} callback - The function invoked to mark the completion of the conversion process.
* @returns {*}
*/
convertResponse: function (object, options, callback) {
Expand All @@ -140,8 +140,8 @@ module.exports = {
/**
* Returns a builder, which can be used to convert individual requests, etc.
*
* @param options
* @returns {options}
* @param {Object} options - The set of options for builder creation.
* @returns {Function} - The builder for the given set of options.
*/
builder: function (options) {
var chosenConverter = this.getConverter(options.inputVersion, options.outputVersion);
Expand Down

0 comments on commit 1055c6d

Please sign in to comment.