From 7516fd5929edc19228cbcd4793b2894fc6107828 Mon Sep 17 00:00:00 2001 From: JaySoni1 Date: Thu, 13 Mar 2025 22:06:49 +0530 Subject: [PATCH 1/4] Update sync.js Signed-off-by: JaySoni1 --- .../@stdlib/_tools/pkgs/deps/lib/sync.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/node_modules/@stdlib/_tools/pkgs/deps/lib/sync.js b/lib/node_modules/@stdlib/_tools/pkgs/deps/lib/sync.js index bcd54eff93b8..0dc65f8def57 100644 --- a/lib/node_modules/@stdlib/_tools/pkgs/deps/lib/sync.js +++ b/lib/node_modules/@stdlib/_tools/pkgs/deps/lib/sync.js @@ -32,12 +32,10 @@ var validate = require( './validate.js' ); var resolveDeps = require( './resolve.sync.js' ); var resolveDevDeps = require( './resolve_dev.sync.js' ); - // VARIABLES // var debug = logger( 'pkg-deps:sync' ); - // MAIN // /** @@ -58,12 +56,13 @@ var debug = logger( 'pkg-deps:sync' ); * var pkgs = [ '/foo/bar/baz' ]; * * var deps = pkgDeps( pkgs ); -* // returns [{...}] +* // throws */ function pkgDeps( pkgs, options ) { var results; var opts; var err; + if ( !isStringArray( pkgs ) ) { throw new TypeError( format( 'invalid argument. First argument must be an array of strings. Value: `%s`.', pkgs ) ); } @@ -75,6 +74,7 @@ function pkgDeps( pkgs, options ) { } } debug( 'Options: %s', JSON.stringify( opts ) ); + if ( opts.dir ) { opts.dir = path.resolve( cwd(), opts.dir ); } else { @@ -94,23 +94,25 @@ function pkgDeps( pkgs, options ) { results = resolveDeps( results, opts.builtins ); if ( results instanceof Error ) { debug( 'Encountered an error when resolving package dependencies: %s', results.message ); - return results; + throw results; } debug( 'Successfully resolved package dependencies.' ); + if ( opts.dev === false ) { return results; } + debug( 'Resolving package dev dependencies...' ); results = resolveDevDeps( results, opts ); if ( results instanceof Error ) { debug( 'Encountered an error when resolving package dev dependencies: %s', results.message ); - return results; + throw results; } debug( 'Successfully resolved package dev dependencies.' ); + return results; } - // EXPORTS // module.exports = pkgDeps; From 9b72a87eee7a0b15949fbf3144eb672f61baedef Mon Sep 17 00:00:00 2001 From: JaySoni1 Date: Thu, 13 Mar 2025 22:26:09 +0530 Subject: [PATCH 2/4] Update sync.js Signed-off-by: JaySoni1 --- .../@stdlib/_tools/pkgs/deps/lib/sync.js | 42 +++++-------------- 1 file changed, 10 insertions(+), 32 deletions(-) diff --git a/lib/node_modules/@stdlib/_tools/pkgs/deps/lib/sync.js b/lib/node_modules/@stdlib/_tools/pkgs/deps/lib/sync.js index 0dc65f8def57..7721a2a1ea3e 100644 --- a/lib/node_modules/@stdlib/_tools/pkgs/deps/lib/sync.js +++ b/lib/node_modules/@stdlib/_tools/pkgs/deps/lib/sync.js @@ -1,25 +1,5 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* 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 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - 'use strict'; -// MODULES // - var path = require( 'path' ); var logger = require( 'debug' ); var isStringArray = require( '@stdlib/assert/is-string-array' ).primitives; @@ -32,12 +12,8 @@ var validate = require( './validate.js' ); var resolveDeps = require( './resolve.sync.js' ); var resolveDevDeps = require( './resolve_dev.sync.js' ); -// VARIABLES // - var debug = logger( 'pkg-deps:sync' ); -// MAIN // - /** * Synchronously resolves package dependencies. * @@ -47,10 +23,8 @@ var debug = logger( 'pkg-deps:sync' ); * @param {boolean} [options.builtins=false] - boolean indicating whether to include built-in packages * @param {boolean} [options.dev=false] - boolean indicating whether to resolve dev dependencies * @throws {TypeError} first argument must be an array of strings -* @throws {TypeError} callback argument must be a function * @throws {TypeError} options argument must be an object -* @throws {TypeError} must provide valid options -* @returns {ObjectArray} resolved dependencies +* @returns {ObjectArray|Error} resolved dependencies or an error * * @example * var pkgs = [ '/foo/bar/baz' ]; @@ -66,6 +40,7 @@ function pkgDeps( pkgs, options ) { if ( !isStringArray( pkgs ) ) { throw new TypeError( format( 'invalid argument. First argument must be an array of strings. Value: `%s`.', pkgs ) ); } + opts = copy( defaults ); if ( arguments.length > 1 ) { err = validate( opts, options ); @@ -73,6 +48,7 @@ function pkgDeps( pkgs, options ) { throw err; } } + debug( 'Options: %s', JSON.stringify( opts ) ); if ( opts.dir ) { @@ -80,22 +56,25 @@ function pkgDeps( pkgs, options ) { } else { opts.dir = cwd(); } + debug( 'Base directory: %s', opts.dir ); debug( 'Resolving package entry points...' ); results = entryPoints( pkgs, opts ); if ( results instanceof Error ) { debug( 'Encountered an error when resolving package entry points: %s', results.message ); - throw results; + return results; } + debug( 'Successfully resolved package entry points.' ); debug( 'Resolving package dependencies...' ); results = resolveDeps( results, opts.builtins ); if ( results instanceof Error ) { debug( 'Encountered an error when resolving package dependencies: %s', results.message ); - throw results; + return results; } + debug( 'Successfully resolved package dependencies.' ); if ( opts.dev === false ) { @@ -106,13 +85,12 @@ function pkgDeps( pkgs, options ) { results = resolveDevDeps( results, opts ); if ( results instanceof Error ) { debug( 'Encountered an error when resolving package dev dependencies: %s', results.message ); - throw results; + return results; } + debug( 'Successfully resolved package dev dependencies.' ); return results; } -// EXPORTS // - module.exports = pkgDeps; From 29e8db4e5034fcc33b107c423fb5acefe6a0b9dd Mon Sep 17 00:00:00 2001 From: JaySoni1 Date: Fri, 14 Mar 2025 22:42:20 +0530 Subject: [PATCH 3/4] Update sync.js Signed-off-by: JaySoni1 --- .../@stdlib/_tools/pkgs/deps/lib/sync.js | 175 +++++++++++------- 1 file changed, 103 insertions(+), 72 deletions(-) diff --git a/lib/node_modules/@stdlib/_tools/pkgs/deps/lib/sync.js b/lib/node_modules/@stdlib/_tools/pkgs/deps/lib/sync.js index 7721a2a1ea3e..226e929fc20b 100644 --- a/lib/node_modules/@stdlib/_tools/pkgs/deps/lib/sync.js +++ b/lib/node_modules/@stdlib/_tools/pkgs/deps/lib/sync.js @@ -1,18 +1,42 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2018 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* 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 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + 'use strict'; -var path = require( 'path' ); -var logger = require( 'debug' ); -var isStringArray = require( '@stdlib/assert/is-string-array' ).primitives; -var format = require( '@stdlib/string/format' ); -var copy = require( '@stdlib/utils/copy' ); -var cwd = require( '@stdlib/process/cwd' ); -var entryPoints = require( '@stdlib/_tools/pkgs/entry-points' ).sync; -var defaults = require( './defaults.json' ); -var validate = require( './validate.js' ); -var resolveDeps = require( './resolve.sync.js' ); -var resolveDevDeps = require( './resolve_dev.sync.js' ); +// MODULES // + +var path = require('path'); +var logger = require('debug'); +var isStringArray = require('@stdlib/assert/is-string-array').primitives; +var format = require('@stdlib/string/format'); +var copy = require('@stdlib/utils/copy'); +var cwd = require('@stdlib/process/cwd'); +var entryPoints = require('@stdlib/_tools/pkgs/entry-points').sync; +var defaults = require('./defaults.json'); +var validate = require('./validate.js'); +var resolveDeps = require('./resolve.sync.js'); +var resolveDevDeps = require('./resolve_dev.sync.js'); + +// VARIABLES // -var debug = logger( 'pkg-deps:sync' ); +var debug = logger('pkg-deps:sync'); + +// MAIN // /** * Synchronously resolves package dependencies. @@ -30,67 +54,74 @@ var debug = logger( 'pkg-deps:sync' ); * var pkgs = [ '/foo/bar/baz' ]; * * var deps = pkgDeps( pkgs ); -* // throws +* // returns [{...}] */ -function pkgDeps( pkgs, options ) { - var results; - var opts; - var err; - - if ( !isStringArray( pkgs ) ) { - throw new TypeError( format( 'invalid argument. First argument must be an array of strings. Value: `%s`.', pkgs ) ); - } - - opts = copy( defaults ); - if ( arguments.length > 1 ) { - err = validate( opts, options ); - if ( err ) { - throw err; - } - } - - debug( 'Options: %s', JSON.stringify( opts ) ); - - if ( opts.dir ) { - opts.dir = path.resolve( cwd(), opts.dir ); - } else { - opts.dir = cwd(); - } - - debug( 'Base directory: %s', opts.dir ); - - debug( 'Resolving package entry points...' ); - results = entryPoints( pkgs, opts ); - if ( results instanceof Error ) { - debug( 'Encountered an error when resolving package entry points: %s', results.message ); - return results; - } - - debug( 'Successfully resolved package entry points.' ); - - debug( 'Resolving package dependencies...' ); - results = resolveDeps( results, opts.builtins ); - if ( results instanceof Error ) { - debug( 'Encountered an error when resolving package dependencies: %s', results.message ); - return results; - } - - debug( 'Successfully resolved package dependencies.' ); - - if ( opts.dev === false ) { - return results; - } - - debug( 'Resolving package dev dependencies...' ); - results = resolveDevDeps( results, opts ); - if ( results instanceof Error ) { - debug( 'Encountered an error when resolving package dev dependencies: %s', results.message ); - return results; - } - - debug( 'Successfully resolved package dev dependencies.' ); - - return results; +function pkgDeps(pkgs, options) { + var results; + var opts; + var err; + + // Validate input: `pkgs` must be an array of strings + if (!isStringArray(pkgs)) { + throw new TypeError(format('invalid argument. First argument must be an array of strings. Value: `%s`.', pkgs)); + } + + // Copy default options and validate user-provided options + opts = copy(defaults); + if (arguments.length > 1) { + debug('Validating options...'); + err = validate(opts, options); + if (err) { + debug('Options validation failed: %s', err.message); + throw err; + } + } + + debug('Options: %s', JSON.stringify(opts)); + + // Resolve base directory + if (opts.dir) { + opts.dir = path.resolve(cwd(), opts.dir); + } else { + opts.dir = cwd(); + } + debug('Base directory: %s', opts.dir); + + // Resolve package entry points + debug('Resolving package entry points...'); + results = entryPoints(pkgs, opts); + if (results instanceof Error) { + debug('Encountered an error when resolving package entry points: %s', results.message); + throw results; + } + debug('Successfully resolved package entry points.'); + + // Resolve main dependencies + debug('Resolving package dependencies...'); + results = resolveDeps(results, opts.builtins); + if (results instanceof Error) { + debug('Encountered an error when resolving package dependencies: %s', results.message); + return results; + } + debug('Successfully resolved package dependencies.'); + + // If dev dependencies are not required, return results + if (opts.dev === false) { + return results; + } + + // Resolve dev dependencies + debug('Resolving package dev dependencies...'); + results = resolveDevDeps(results, opts); + if (results instanceof Error) { + debug('Encountered an error when resolving package dev dependencies: %s', results.message); + return results; + } + debug('Successfully resolved package dev dependencies.'); + + return results; } +// EXPORTS // + module.exports = pkgDeps; From 80d7721926ca76806e703a4103043656ee274299 Mon Sep 17 00:00:00 2001 From: JaySoni1 Date: Sat, 22 Mar 2025 12:41:34 +0530 Subject: [PATCH 4/4] Update ndarray.js Signed-off-by: JaySoni1 --- .../@stdlib/stats/base/meanpn/lib/ndarray.js | 87 ++++++++++--------- 1 file changed, 44 insertions(+), 43 deletions(-) diff --git a/lib/node_modules/@stdlib/stats/base/meanpn/lib/ndarray.js b/lib/node_modules/@stdlib/stats/base/meanpn/lib/ndarray.js index 0707013def95..c7159e011d6c 100644 --- a/lib/node_modules/@stdlib/stats/base/meanpn/lib/ndarray.js +++ b/lib/node_modules/@stdlib/stats/base/meanpn/lib/ndarray.js @@ -1,20 +1,20 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2020 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* 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 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ +/** + * @license Apache-2.0 + * + * Copyright (c) 2020 The Stdlib Authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ 'use strict'; @@ -27,32 +27,33 @@ var gapxsumpw = require( '@stdlib/blas/ext/base/gapxsumpw' ).ndarray; // MAIN // /** -* Computes the arithmetic mean of a strided array using a two-pass error correction algorithm. -* -* ## Method -* -* - This implementation uses a two-pass approach, as suggested by Neely (1966). -* -* ## References -* -* - Neely, Peter M. 1966. "Comparison of Several Algorithms for Computation of Means, Standard Deviations and Correlation Coefficients." _Communications of the ACM_ 9 (7). Association for Computing Machinery: 496–99. doi:[10.1145/365719.365958](https://doi.org/10.1145/365719.365958). -* - Schubert, Erich, and Michael Gertz. 2018. "Numerically Stable Parallel Computation of (Co-)Variance." In _Proceedings of the 30th International Conference on Scientific and Statistical Database Management_. New York, NY, USA: Association for Computing Machinery. doi:[10.1145/3221269.3223036](https://doi.org/10.1145/3221269.3223036). -* -* @param {PositiveInteger} N - number of indexed elements -* @param {NumericArray} x - input array -* @param {integer} stride - stride length -* @param {NonNegativeInteger} offset - starting index -* @returns {number} arithmetic mean -* -* @example -* var floor = require( '@stdlib/math/base/special/floor' ); -* -* var x = [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ]; -* var N = floor( x.length / 2 ); -* -* var v = meanpn( N, x, 2, 1 ); -* // returns 1.25 -*/ + * Computes the arithmetic mean of a strided array using a two-pass error correction algorithm. + * + * ## Method + * + * - This implementation uses a two-pass approach, as suggested by Neely (1966). + * + * ## References + * + * - Neely, Peter M. 1966. "Comparison of Several Algorithms for Computation of Means, Standard Deviations and Correlation Coefficients." _Communications of the ACM_ 9 (7). Association for Computing Machinery: 496–99. doi:[10.1145/365719.365958](https://doi.org/10.1145/365719.365958). + * - Schubert, Erich, and Michael Gertz. 2018. "Numerically Stable Parallel Computation of (Co-)Variance." In _Proceedings of the 30th International Conference on Scientific and Statistical Database Management_. New York, NY, USA: Association for Computing Machinery. doi:[10.1145/3221269.3223036](https://doi.org/10.1145/3221269.3223036). + * + * @param {PositiveInteger} N - number of indexed elements + * @param {NumericArray} x - input array + * @param {integer} stride - stride length + * @param {NonNegativeInteger} offset - starting index + * @returns {number} arithmetic mean + * + * @example + * var floor = require( '@stdlib/math/base/special/floor' ); + * + * var x = [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ]; + * var N = floor( x.length / 2 ); + * + * var v = meanpn( N, x, 2, 1 ); + * // returns 1.25 + */ +// cspell:ignore meanpn function meanpn( N, x, stride, offset ) { var mu; var c;