Skip to content

Commit 9250c59

Browse files
committed
refactor: use ndarray defaults
1 parent 9dbf98e commit 9250c59

File tree

3 files changed

+60
-11
lines changed

3 files changed

+60
-11
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
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+
// MODULES //
22+
23+
var settings = require( '@stdlib/ndarray/defaults' );
24+
25+
26+
// MAIN //
27+
28+
/**
29+
* Returns default options.
30+
*
31+
* @private
32+
* @returns {Object} default options
33+
*
34+
* @example
35+
* var o = defaults();
36+
* // returns {...}
37+
*/
38+
function defaults() {
39+
return {
40+
'casting': settings.get( 'casting' ),
41+
'copy': false,
42+
'dtype': settings.get( 'dtypes.default' ),
43+
'flatten': true,
44+
'mode': settings.get( 'index_mode' ),
45+
'ndmin': 0,
46+
'order': settings.get( 'order' ),
47+
'readonly': false
48+
};
49+
}
50+
51+
52+
// EXPORTS //
53+
54+
module.exports = defaults;

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

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

lib/node_modules/@stdlib/ndarray/array/lib/main.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,18 @@ var arrayShape = require( '@stdlib/array/shape' );
4141
var flattenArray = require( '@stdlib/utils/flatten-array' );
4242
var format = require( '@stdlib/string/format' );
4343
var isArrayLikeObject = require( './is_array_like_object.js' );
44-
var defaults = require( './defaults.json' );
44+
var getDefaults = require( './defaults.js' );
4545
var castBuffer = require( './cast_buffer.js' );
4646
var copyView = require( './copy_view.js' );
4747
var expandShape = require( './expand_shape.js' );
4848
var expandStrides = require( './expand_strides.js' );
4949

5050

51+
// VARIABLES //
52+
53+
var defaults = getDefaults();
54+
55+
5156
// MAIN //
5257

5358
/**

0 commit comments

Comments
 (0)