Skip to content

Commit 43b454e

Browse files
committed
refactor: avoid usage of utils/copy
1 parent 45a6884 commit 43b454e

File tree

14 files changed

+219
-56
lines changed

14 files changed

+219
-56
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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+
* @example
30+
* var o = defaults();
31+
* // returns {...}
32+
*/
33+
function defaults() {
34+
return {
35+
'highWaterMark': 9007199254740992
36+
};
37+
}
38+
39+
40+
// EXPORTS //
41+
42+
module.exports = defaults;

lib/node_modules/@stdlib/array/pool/lib/defaults.json

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

lib/node_modules/@stdlib/array/pool/lib/factory.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,13 @@ var reinterpret128 = require( '@stdlib/strided/base/reinterpret-complex128' );
3535
var accessors = require( '@stdlib/array/base/accessors' );
3636
var adtype = require( '@stdlib/array/dtype' );
3737
var format = require( '@stdlib/string/format' );
38-
var copy = require( '@stdlib/utils/copy' );
3938
var ArrayBuffer = require( '@stdlib/array/buffer' );
4039
var ceil = require( '@stdlib/math/base/special/ceil' );
4140
var floor = require( '@stdlib/math/base/special/floor' );
4241
var ceil2 = require( '@stdlib/math/base/special/ceil2' );
4342
var log2 = require( '@stdlib/math/base/special/log2' );
4443
var min = require( '@stdlib/math/base/special/min' );
45-
var defaults = require( './defaults.json' );
44+
var defaults = require( './defaults.js' );
4645
var validate = require( './validate.js' );
4746
var createPool = require( './pool.js' );
4847
var BYTES_PER_ELEMENT = require( './bytes_per_element.json' );
@@ -111,7 +110,7 @@ function factory( options ) {
111110
var opts;
112111
var err;
113112

114-
opts = copy( defaults );
113+
opts = defaults();
115114
if ( arguments.length ) {
116115
err = validate( opts, options );
117116
if ( err ) {
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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+
* @example
30+
* var o = defaults();
31+
* // returns {...}
32+
*/
33+
function defaults() {
34+
return {
35+
'init': 100,
36+
'alpha': 0.05,
37+
'alternative': 'two-sided',
38+
'digits': 4,
39+
'decision': true
40+
};
41+
}
42+
43+
44+
// EXPORTS //
45+
46+
module.exports = defaults;

lib/node_modules/@stdlib/stats/incr/grubbs/lib/defaults.json

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

lib/node_modules/@stdlib/stats/incr/grubbs/lib/main.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ var isPositiveInteger = require( '@stdlib/assert/is-positive-integer' ).isPrimit
2626
var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive;
2727
var incrminmax = require( '@stdlib/stats/incr/minmax' );
2828
var incrmeanstdev = require( '@stdlib/stats/incr/meanstdev' );
29-
var copy = require( '@stdlib/utils/copy' );
3029
var setReadOnly = require( '@stdlib/utils/define-read-only-property' );
3130
var setReadOnlyAccessor = require( '@stdlib/utils/define-read-only-accessor' );
3231
var max = require( '@stdlib/math/base/special/max' );
@@ -35,7 +34,7 @@ var roundn = require( '@stdlib/math/base/special/roundn' );
3534
var tQuantile = require( '@stdlib/stats/base/dists/t/quantile' );
3635
var format = require( '@stdlib/string/format' );
3736
var validate = require( './validate.js' );
38-
var defaults = require( './defaults.json' );
37+
var defaults = require( './defaults.js' );
3938

4039

4140
// MAIN //
@@ -83,7 +82,7 @@ function incrgrubbs() {
8382
var N;
8483
var G;
8584

86-
opts = copy( defaults );
85+
opts = defaults();
8786
if ( arguments.length ) {
8887
err = validate( opts, arguments[ 0 ] );
8988
if ( err ) {
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
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+
* @example
30+
* var o = defaults();
31+
* // returns {...}
32+
*/
33+
function defaults() {
34+
return {
35+
'alpha': 0.05,
36+
'alternative': 'two-sided',
37+
'digits': 4,
38+
'decision': true
39+
};
40+
}
41+
42+
43+
// EXPORTS //
44+
45+
module.exports = defaults;

lib/node_modules/@stdlib/stats/incr/mgrubbs/lib/defaults.json

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

lib/node_modules/@stdlib/stats/incr/mgrubbs/lib/main.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ var hasOwnProp = require( '@stdlib/assert/has-own-property' );
2424
var isObject = require( '@stdlib/assert/is-plain-object' );
2525
var isPositiveInteger = require( '@stdlib/assert/is-positive-integer' ).isPrimitive;
2626
var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive;
27-
var copy = require( '@stdlib/utils/copy' );
2827
var setReadOnly = require( '@stdlib/utils/define-read-only-property' );
2928
var setReadOnlyAccessor = require( '@stdlib/utils/define-read-only-accessor' );
3029
var max = require( '@stdlib/math/base/special/max' );
@@ -34,7 +33,7 @@ var format = require( '@stdlib/string/format' );
3433
var tQuantile = require( '@stdlib/stats/base/dists/t/quantile' );
3534
var Float64Array = require( '@stdlib/array/float64' );
3635
var validate = require( './validate.js' );
37-
var defaults = require( './defaults.json' );
36+
var defaults = require( './defaults.js' );
3837
var incrmminmax = require( './minmax.js' );
3938
var incrmmeanstdev = require( './meanstdev.js' );
4039

@@ -91,7 +90,7 @@ function incrmgrubbs( W ) {
9190
if ( W < 3 ) {
9291
throw new RangeError( format( 'invalid argument. Window size must be greater than or equal to 3. Value: `%s`.', W ) );
9392
}
94-
opts = copy( defaults );
93+
opts = defaults();
9594
if ( arguments.length > 1 ) {
9695
err = validate( opts, arguments[ 1 ] );
9796
if ( err ) {
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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+
* @example
30+
* var o = defaults();
31+
* // returns {...}
32+
*/
33+
function defaults() {
34+
return {
35+
'objectMode': false,
36+
'encoding': null,
37+
'allowHalfOpen': false,
38+
'readableObjectMode': false,
39+
'sep': '\n'
40+
};
41+
}
42+
43+
44+
// EXPORTS //
45+
46+
module.exports = defaults;

0 commit comments

Comments
 (0)