README.md (2517B)
1 <!-- 2 3 @license Apache-2.0 4 5 Copyright (c) 2018 The Stdlib Authors. 6 7 Licensed under the Apache License, Version 2.0 (the "License"); 8 you may not use this file except in compliance with the License. 9 You may obtain a copy of the License at 10 11 http://www.apache.org/licenses/LICENSE-2.0 12 13 Unless required by applicable law or agreed to in writing, software 14 distributed under the License is distributed on an "AS IS" BASIS, 15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 See the License for the specific language governing permissions and 17 limitations under the License. 18 19 --> 20 21 # Orders 22 23 > List of ndarray orders. 24 25 <!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. --> 26 27 <section class="intro"> 28 29 </section> 30 31 <!-- /.intro --> 32 33 <!-- Package usage documentation. --> 34 35 <section class="usage"> 36 37 ## Usage 38 39 ```javascript 40 var orders = require( '@stdlib/ndarray/orders' ); 41 ``` 42 43 #### orders() 44 45 Returns a list of ndarray orders. 46 47 ```javascript 48 var out = orders(); 49 // returns [ 'row-major', 'column-major' ] 50 ``` 51 52 The output `array` contains the following orders: 53 54 - `row-major`: row-major (C-style) order. 55 - `column-major`: column-major (Fortran-style) order. 56 57 </section> 58 59 <!-- /.usage --> 60 61 <!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> 62 63 <section class="notes"> 64 65 </section> 66 67 <!-- /.notes --> 68 69 <!-- Package usage examples. --> 70 71 <section class="examples"> 72 73 ## Examples 74 75 <!-- eslint no-undef: "error" --> 76 77 ```javascript 78 var indexOf = require( '@stdlib/utils/index-of' ); 79 var orders = require( '@stdlib/ndarray/orders' ); 80 81 var ORDERS = orders(); 82 var bool; 83 84 function isOrder( str ) { 85 if ( indexOf( ORDERS, str ) === -1 ) { 86 return false; 87 } 88 return true; 89 } 90 91 bool = isOrder( 'row-major' ); 92 // returns true 93 94 bool = isOrder( 'column-major' ); 95 // returns true 96 97 bool = isOrder( 'beep' ); 98 // returns false 99 ``` 100 101 </section> 102 103 <!-- /.examples --> 104 105 <!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> 106 107 <section class="references"> 108 109 </section> 110 111 <!-- /.references --> 112 113 <!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> 114 115 <section class="links"> 116 117 </section> 118 119 <!-- /.links -->