byteOrders

List of byte orders.

Usage

var byteOrders = require( '@stdlib/array/byte-orders' );

byteOrders()

Returns a list of byte orders.

var out = byteOrders();
// e.g., returns [ 'little-endian', 'big-endian' ]

The output array contains the following orders:

  • little-endian: bytes are ordered from least-to-most significant byte.
  • big-endian: bytes are ordered from most-to-least significant byte.

Examples

var contains = require( '@stdlib/array/base/assert/contains' ).factory;
var byteOrders = require( '@stdlib/array/byte-orders' );

var isByteOrder = contains( byteOrders() );

var bool = isByteOrder( 'little-endian' );
// returns true

bool = isByteOrder( 'big-endian' );
// returns true

bool = isByteOrder( 'beep' );
// returns false
Did you find this page helpful?