-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.mjs.map
1 lines (1 loc) · 2.35 KB
/
index.mjs.map
1
{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isndarrayLike from '@stdlib/assert-is-ndarray-like';\nimport toArray from '@stdlib/ndarray-base-to-array';\nimport getStrides from '@stdlib/ndarray-strides';\nimport getOffset from '@stdlib/ndarray-offset';\nimport getShape from '@stdlib/ndarray-shape';\nimport getOrder from '@stdlib/ndarray-order';\nimport getData from '@stdlib/ndarray-data-buffer';\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// MAIN //\n\n/**\n* Converts an ndarray to a generic array (which may include nested arrays).\n*\n* @param {ndarrayLike} x - input ndarray\n* @throws {TypeError} must provide an ndarray\n* @returns {(EmptyArray|Array|Array<Array>)} array (which may include nested arrays)\n*\n* @example\n* import ndarray from '@stdlib/ndarray-ctor';\n*\n* var buffer = [ 1, 2, 3, 4 ];\n* var shape = [ 2, 2 ];\n* var order = 'row-major';\n* var strides = [ 2, 1 ];\n* var offset = 0;\n*\n* var arr = ndarray( 'generic', buffer, shape, strides, offset, order );\n*\n* var out = ndarray2array( arr );\n* // returns [ [ 1, 2 ], [ 3, 4 ] ]\n*/\nfunction ndarray2array( x ) {\n\tif ( !isndarrayLike( x ) ) {\n\t\tthrow new TypeError( format( '1dfDv', x ) );\n\t}\n\treturn toArray( getData( x ), getShape( x ), getStrides( x ), getOffset( x ), getOrder( x ) ); // eslint-disable-line max-len\n}\n\n\n// EXPORTS //\n\nexport default ndarray2array;\n"],"names":["ndarray2array","x","isndarrayLike","TypeError","format","toArray","getData","getShape","getStrides","getOffset","getOrder"],"mappings":";;muBAuDA,SAASA,EAAeC,GACvB,IAAMC,EAAeD,GACpB,MAAM,IAAIE,UAAWC,EAAQ,QAASH,IAEvC,OAAOI,EAASC,EAASL,GAAKM,EAAUN,GAAKO,EAAYP,GAAKQ,EAAWR,GAAKS,EAAUT,GACzF"}