|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 13 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
606 bytes
|
| Line | |
|---|
| 1 | 'use strict';
|
|---|
| 2 |
|
|---|
| 3 | var GetIntrinsic = require('get-intrinsic');
|
|---|
| 4 |
|
|---|
| 5 | var $Uint8Array = GetIntrinsic('%Uint8Array%', true);
|
|---|
| 6 | var $Uint32Array = GetIntrinsic('%Uint32Array%', true);
|
|---|
| 7 |
|
|---|
| 8 | var typedArrayBuffer = require('typed-array-buffer');
|
|---|
| 9 |
|
|---|
| 10 | var uInt32 = $Uint32Array && new $Uint32Array([0x12345678]);
|
|---|
| 11 | var uInt8 = uInt32 && new $Uint8Array(typedArrayBuffer(uInt32));
|
|---|
| 12 |
|
|---|
| 13 | module.exports = uInt8
|
|---|
| 14 | ? uInt8[0] === 0x78
|
|---|
| 15 | ? 'little'
|
|---|
| 16 | : uInt8[0] === 0x12
|
|---|
| 17 | ? 'big'
|
|---|
| 18 | : uInt8[0] === 0x34
|
|---|
| 19 | ? 'mixed' // https://developer.mozilla.org/en-US/docs/Glossary/Endianness
|
|---|
| 20 | : 'unknown' // ???
|
|---|
| 21 | : 'indeterminate'; // no way to know
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.