diff --git a/lib/node_modules/@stdlib/_tools/github/create-repo/lib/factory.js b/lib/node_modules/@stdlib/_tools/github/create-repo/lib/factory.js index 6498670ecbf4..dcd4c40ffac1 100644 --- a/lib/node_modules/@stdlib/_tools/github/create-repo/lib/factory.js +++ b/lib/node_modules/@stdlib/_tools/github/create-repo/lib/factory.js @@ -7,7 +7,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * -* http://www.apache.org/licenses/LICENSE-2.0 +* http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -65,22 +65,34 @@ var DEFAULT_HTTPS_PORT = 443; function factory( options, clbk ) { var opts; var err; + opts = copy( defaults ); err = validate( opts, options ); if ( err ) { throw err; } if ( opts.port === null ) { - if ( opts.protocol === 'https' ) { - opts.port = DEFAULT_HTTPS_PORT; - } else { - opts.port = DEFAULT_HTTP_PORT; - } + opts.port = ( opts.protocol === 'https' ) ? DEFAULT_HTTPS_PORT : DEFAULT_HTTP_PORT; } if ( !isFunction( clbk ) ) { throw new TypeError( format( 'invalid argument. Callback argument must be a function. Value: `%s`.', clbk ) ); } - return createRepo; + + /** + * Callback invoked after receiving an API response. + * + * @private + * @param {(Error|null)} error - error object + * @param {Object} data - query data + * @param {Object} info - response info + * @returns {void} + */ + function done( error, data, info ) { + error = error || null; + data = data || null; + info = info || null; + clbk( error, data, info ); + } /** * Creates a GitHub repository. @@ -95,25 +107,13 @@ function factory( options, clbk ) { throw new TypeError( format( 'invalid argument. Repository name must be a string. Value: `%s`.', name ) ); } query( name, opts, done ); - /** - * Callback invoked after receiving an API response. - * - * @private - * @param {(Error|null)} error - error object - * @param {ObjectArray} data - query data - * @param {Object} info - response info - * @returns {void} - */ - function done( error, data, info ) { - error = error || null; - data = data || null; - info = info || null; - clbk( error, data, info ); - } } + + return createRepo; } + // EXPORTS // module.exports = factory;