Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 22 additions & 22 deletions lib/node_modules/@stdlib/_tools/github/create-repo/lib/factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -65,22 +65,34 @@
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.
Expand All @@ -95,25 +107,13 @@
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;
}

Check failure on line 113 in lib/node_modules/@stdlib/_tools/github/create-repo/lib/factory.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Not more than two blank lines are allowed before a section header



// EXPORTS //

module.exports = factory;
Loading