Skip to content

Commit e19ecd3

Browse files
committed
Refactor to not use utils/copy
1 parent 6dae74a commit e19ecd3

9 files changed

Lines changed: 120 additions & 18 deletions

File tree

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+
'copy': true
32+
};
33+
}
34+
35+
36+
// EXPORTS //
37+
38+
module.exports = defaults;

lib/node_modules/@stdlib/simulate/iter/awgn/lib/defaults.json

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

lib/node_modules/@stdlib/simulate/iter/awgn/lib/main.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,12 @@ var isFunction = require( '@stdlib/assert/is-function' );
3030
var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive;
3131
var isUint32Array = require( '@stdlib/assert/is-uint32array' );
3232
var hasOwnProp = require( '@stdlib/assert/has-own-property' );
33-
var copy = require( '@stdlib/utils/copy' );
3433
var noop = require( '@stdlib/utils/noop' );
3534
var constantFunction = require( '@stdlib/utils/constant-function' );
3635
var iteratorSymbol = require( '@stdlib/symbol/iterator' );
3736
var format = require( '@stdlib/string/format' );
3837
var randn = require( '@stdlib/random/base/improved-ziggurat' ).factory;
39-
var DEFAULTS = require( './defaults.json' );
38+
var defaults = require( './defaults.js' );
4039

4140

4241
// MAIN //
@@ -89,7 +88,7 @@ function iterawgn( iterator, sigma, options ) {
8988
if ( !isPositiveNumber( sigma ) ) {
9089
throw new TypeError( format( 'invalid argument. Second argument must be a positive number. Value: `%s`.', sigma ) );
9190
}
92-
opts = copy( DEFAULTS );
91+
opts = defaults();
9392
if ( arguments.length > 2 ) {
9493
if ( !isPlainObject( options ) ) {
9594
throw new TypeError( format( 'invalid argument. Third argument must be an object. Value: `%s`.', options ) );
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+
'copy': true
32+
};
33+
}
34+
35+
36+
// EXPORTS //
37+
38+
module.exports = defaults;

lib/node_modules/@stdlib/simulate/iter/awln/lib/defaults.json

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

lib/node_modules/@stdlib/simulate/iter/awln/lib/main.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,13 @@ var isFunction = require( '@stdlib/assert/is-function' );
3030
var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive;
3131
var isUint32Array = require( '@stdlib/assert/is-uint32array' );
3232
var hasOwnProp = require( '@stdlib/assert/has-own-property' );
33-
var copy = require( '@stdlib/utils/copy' );
3433
var noop = require( '@stdlib/utils/noop' );
3534
var constantFunction = require( '@stdlib/utils/constant-function' );
3635
var iteratorSymbol = require( '@stdlib/symbol/iterator' );
3736
var laplace = require( '@stdlib/random/base/laplace' ).factory;
3837
var format = require( '@stdlib/string/format' );
3938
var SQRT_TWO = require( '@stdlib/constants/float64/sqrt-two' );
40-
var DEFAULTS = require( './defaults.json' );
39+
var defaults = require( './defaults.js' );
4140

4241

4342
// MAIN //
@@ -112,7 +111,7 @@ function iterawln( iterator, sigma, options ) {
112111
if ( !isPositiveNumber( sigma ) ) {
113112
throw new TypeError( format( 'invalid argument. Second argument must be a positive number. Value: `%s`.', sigma ) );
114113
}
115-
opts = copy( DEFAULTS );
114+
opts = defaults();
116115
if ( arguments.length > 2 ) {
117116
if ( !isPlainObject( options ) ) {
118117
throw new TypeError( format( 'invalid argument. Third argument must be an object. Value: `%s`.', options ) );
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+
'copy': true
32+
};
33+
}
34+
35+
36+
// EXPORTS //
37+
38+
module.exports = defaults;

lib/node_modules/@stdlib/simulate/iter/awun/lib/defaults.json

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

lib/node_modules/@stdlib/simulate/iter/awun/lib/main.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,13 @@ var isFunction = require( '@stdlib/assert/is-function' );
3030
var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive;
3131
var isUint32Array = require( '@stdlib/assert/is-uint32array' );
3232
var hasOwnProp = require( '@stdlib/assert/has-own-property' );
33-
var copy = require( '@stdlib/utils/copy' );
3433
var noop = require( '@stdlib/utils/noop' );
3534
var constantFunction = require( '@stdlib/utils/constant-function' );
3635
var format = require( '@stdlib/string/format' );
3736
var iteratorSymbol = require( '@stdlib/symbol/iterator' );
3837
var randu = require( '@stdlib/random/base/uniform' ).factory;
3938
var SQRT_THREE = require( '@stdlib/constants/float64/sqrt-three' );
40-
var DEFAULTS = require( './defaults.json' );
39+
var defaults = require( './defaults.js' );
4140

4241

4342
// MAIN //
@@ -117,7 +116,7 @@ function iterawun( iterator, sigma, options ) {
117116
if ( !isPositiveNumber( sigma ) ) {
118117
throw new TypeError( format( 'invalid argument. Second argument must be a positive number. Value: `%s`.', sigma ) );
119118
}
120-
opts = copy( DEFAULTS );
119+
opts = defaults();
121120
if ( arguments.length > 2 ) {
122121
if ( !isPlainObject( options ) ) {
123122
throw new TypeError( format( 'invalid argument. Third argument must be an object. Value: `%s`.', options ) );

0 commit comments

Comments
 (0)