Skip to content

Commit 6c574af

Browse files
committed
Refactor to not use utils/copy
1 parent e070a4a commit 6c574af

15 files changed

Lines changed: 180 additions & 37 deletions

File tree

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2023 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
'use strict';
20+
21+
// MAIN //
22+
23+
/**
24+
* Returns default options.
25+
*
26+
* @private
27+
* @returns {Object} default options
28+
*/
29+
function defaults() {
30+
return {
31+
'url': 'https://stdlib.io/docs/api/latest/error-decoder.html',
32+
'message': 'Minified stdlib error code: {{code}}. Visit {{url}} for the full message.'
33+
};
34+
}
35+
36+
37+
// EXPORTS //
38+
39+
module.exports = defaults;

lib/node_modules/@stdlib/error/tools/fmtprodmsg-factory/lib/defaults.json

Lines changed: 0 additions & 4 deletions
This file was deleted.

lib/node_modules/@stdlib/error/tools/fmtprodmsg-factory/lib/main.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,8 @@
2121
// MODULES //
2222

2323
var replace = require( '@stdlib/string/replace' );
24-
var copy = require( '@stdlib/utils/copy' );
2524
var validate = require( './validate.js' );
26-
var defaults = require( './defaults.json' );
25+
var defaults = require( './defaults.js' );
2726

2827

2928
// MAIN //
@@ -47,7 +46,7 @@ var defaults = require( './defaults.json' );
4746
function fmtprodmsgFactory( options ) {
4847
var opts;
4948
var err;
50-
opts = copy( defaults );
49+
opts = defaults();
5150
if ( arguments.length > 0 ) {
5251
err = validate( opts, options );
5352
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2023 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
'use strict';
20+
21+
// MAIN //
22+
23+
/**
24+
* Returns default options.
25+
*
26+
* @private
27+
* @returns {Object} default options
28+
*/
29+
function defaults() {
30+
return {
31+
'alpha': 0.05
32+
};
33+
}
34+
35+
36+
// EXPORTS //
37+
38+
module.exports = defaults;

lib/node_modules/@stdlib/stats/anova1/lib/defaults.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

lib/node_modules/@stdlib/stats/anova1/lib/main.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ var setReadOnly = require( '@stdlib/utils/define-read-only-property' );
2727
var hasOwnProp = require( '@stdlib/assert/has-own-property' );
2828
var format = require( '@stdlib/string/format' );
2929
var cdf = require( '@stdlib/stats/base/dists/f/cdf' );
30-
var copy = require( '@stdlib/utils/copy' );
31-
var defaults = require( './defaults.json' );
30+
var defaults = require( './defaults.js' );
3231
var validate = require( './validate.js' );
3332
var unique = require( './unique.js' );
3433
var meanTable = require( './mean_table.js' );
@@ -79,7 +78,7 @@ function anova1( x, factor, options ) {
7978
if ( !isTypedArrayLike( x ) && !isNumberArray( x ) ) {
8079
throw new TypeError( format( 'invalid argument. First argument must be a numeric array. Value: `%s`.', x ) );
8180
}
82-
opts = copy( defaults );
81+
opts = defaults();
8382
if ( arguments.length > 2 ) {
8483
err = validate( opts, options );
8584
if ( err ) {
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2023 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
'use strict';
20+
21+
// MAIN //
22+
23+
/**
24+
* Returns default options.
25+
*
26+
* @private
27+
* @returns {Object} default options
28+
*/
29+
function defaults() {
30+
return {
31+
'alpha': 0.05,
32+
'correct': true
33+
};
34+
}
35+
36+
37+
// EXPORTS //
38+
39+
module.exports = defaults;

lib/node_modules/@stdlib/stats/chi2test/lib/defaults.json

Lines changed: 0 additions & 4 deletions
This file was deleted.

lib/node_modules/@stdlib/stats/chi2test/lib/main.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,9 @@ var incrmin = require( '@stdlib/stats/incr/min' );
3131
var gsum = require( '@stdlib/blas/ext/base/gsum' );
3232
var min = require( '@stdlib/math/base/special/min' );
3333
var format = require( '@stdlib/string/format' );
34-
var copy = require( '@stdlib/utils/copy' );
3534
var chisqCDF = require( '@stdlib/stats/base/dists/chisquare/cdf' );
3635
var prettyPrint = require( './print.js' );
37-
var defaults = require( './defaults.json' );
36+
var defaults = require( './defaults.js' );
3837
var sumByDimension = require( './sum.js' );
3938
var outer = require( './outer.js' );
4039
var absdiff = require( './absdiff.js' );
@@ -89,7 +88,7 @@ function chi2test( x, options ) {
8988
if ( !isNonNegativeIntegerArray( x.data ) ) {
9089
throw new TypeError( format( 'invalid argument. First argument must contain nonnegative integers. Value: `%s`.', x ) );
9190
}
92-
opts = copy( defaults );
91+
opts = defaults();
9392
if ( arguments.length > 1 ) {
9493
err = validate( opts, options );
9594
if ( err ) {

lib/node_modules/@stdlib/utils/flatten-object/lib/defaults.js

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,19 @@ var FLOAT64_MAX = require( '@stdlib/constants/float64/max' );
2525

2626
// MAIN //
2727

28-
var defaults = {
29-
'delimiter': '.',
30-
'depth': FLOAT64_MAX,
31-
'copy': false
32-
};
28+
/**
29+
* Returns default options.
30+
*
31+
* @private
32+
* @returns {Object} default options
33+
*/
34+
function defaults() {
35+
return {
36+
'delimiter': '.',
37+
'depth': FLOAT64_MAX,
38+
'copy': false
39+
};
40+
}
3341

3442

3543
// EXPORTS //

0 commit comments

Comments
 (0)