source: imaps-frontend/node_modules/es-abstract/helpers/defaultEndianness.js

main
Last change on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 606 bytes
Line 
1'use strict';
2
3var GetIntrinsic = require('get-intrinsic');
4
5var $Uint8Array = GetIntrinsic('%Uint8Array%', true);
6var $Uint32Array = GetIntrinsic('%Uint32Array%', true);
7
8var typedArrayBuffer = require('typed-array-buffer');
9
10var uInt32 = $Uint32Array && new $Uint32Array([0x12345678]);
11var uInt8 = uInt32 && new $Uint8Array(typedArrayBuffer(uInt32));
12
13module.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.