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 04f2b2d06ae4..e4eb0ae81c33 100644 --- a/lib/node_modules/@stdlib/_tools/pkgs/deps/lib/sync.js +++ b/lib/node_modules/@stdlib/_tools/pkgs/deps/lib/sync.js @@ -20,23 +20,21 @@ // 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' ); - +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 // @@ -49,10 +47,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' ]; @@ -60,56 +56,71 @@ var debug = logger( 'pkg-deps:sync' ); * var deps = pkgDeps( pkgs ); * // e.g., 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 ); - throw 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 // 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;