From 560fcd67439d8a52a41040d6844f38aa30f4e58b Mon Sep 17 00:00:00 2001 From: rajanarahul93 Date: Tue, 23 Sep 2025 12:58:51 +0530 Subject: [PATCH 1/2] chore(tools): fix no-unnecessary-nested-functions lint error in factory.js --- .../_tools/github/create-repo/lib/factory.js | 28 +++++++------------ 1 file changed, 10 insertions(+), 18 deletions(-) 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..bc8c432f4cb4 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 @@ -80,7 +80,13 @@ function factory( options, clbk ) { if ( !isFunction( clbk ) ) { throw new TypeError( format( 'invalid argument. Callback argument must be a function. Value: `%s`.', clbk ) ); } - return createRepo; + + function done( error, data, info ) { + error = error || null; + data = data || null; + info = info || null; + clbk( error, data, info ); + } /** * Creates a GitHub repository. @@ -95,24 +101,10 @@ 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 // From 2112bf82eefbc5cd89fabea0fe3c342cef73d86a Mon Sep 17 00:00:00 2001 From: rajanarahul93 Date: Tue, 23 Sep 2025 13:20:54 +0530 Subject: [PATCH 2/2] chore: clean up code --- .../_tools/github/create-repo/lib/factory.js | 36 +++++++++++-------- 1 file changed, 22 insertions(+), 14 deletions(-) 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 bc8c432f4cb4..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,28 +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 ) ); } - function done( error, data, info ) { - error = error || null; - data = data || null; - info = info || null; - clbk( error, data, info ); - } + /** + * 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. @@ -101,11 +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 ); - } + } - return createRepo; + return createRepo; } + + // EXPORTS // module.exports = factory;