How to use the core-js-pure.Uint8Array function in core-js-pure

To help you get started, we’ve selected a few core-js-pure examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github zloirock / core-js / tests / pure / es.typed.conversions.float64.js View on Github external
if (DESCRIPTORS) QUnit.test('Float64 conversions', assert => {
  const float64array = new Float64Array(1);
  const uint8array = new Uint8Array(float64array.buffer);
  const dataview = new DataView(float64array.buffer);

  function viewFrom(it) {
    return new DataView(new Uint8Array(it).buffer);
  }
  function toString(it) {
    return it === 0 && 1 / it === -Infinity ? '-0' : it;
  }

  const data = [
    [0, 0, [0, 0, 0, 0, 0, 0, 0, 0]],
    [-0, -0, [0, 0, 0, 0, 0, 0, 0, 128]],
    [1, 1, [0, 0, 0, 0, 0, 0, 240, 63]],
    [-1, -1, [0, 0, 0, 0, 0, 0, 240, 191]],
    [1.1, 1.1, [154, 153, 153, 153, 153, 153, 241, 63]],
    [-1.1, -1.1, [154, 153, 153, 153, 153, 153, 241, 191]],
github zloirock / core-js / tests / pure / es.typed.conversions.int16.js View on Github external
if (DESCRIPTORS) QUnit.test('Int16 conversions', assert => {
  const int16array = new Int16Array(1);
  const uint8array = new Uint8Array(int16array.buffer);
  const dataview = new DataView(int16array.buffer);

  function viewFrom(it) {
    return new DataView(new Uint8Array(it).buffer);
  }
  function toString(it) {
    return it === 0 && 1 / it === -Infinity ? '-0' : it;
  }

  let data = [
    [0, 0, [0, 0]],
    [-0, 0, [0, 0]],
    [1, 1, [1, 0]],
    [-1, -1, [255, 255]],
    [1.1, 1, [1, 0]],
    [-1.1, -1, [255, 255]],
github zloirock / core-js / tests / pure / es.typed.data-view.js View on Github external
QUnit.test('DataView accessors', assert => {
    const uint8array = new Uint8Array(8);
    const dataview = new DataView(uint8array.buffer);
    assert.arrayEqual(uint8array, [0, 0, 0, 0, 0, 0, 0, 0]);
    dataview.setUint8(0, 255);
    assert.arrayEqual(uint8array, [0xff, 0, 0, 0, 0, 0, 0, 0]);
    dataview.setInt8(1, -1);
    assert.arrayEqual(uint8array, [0xff, 0xff, 0, 0, 0, 0, 0, 0]);
    dataview.setUint16(2, 0x1234);
    assert.arrayEqual(uint8array, [0xff, 0xff, 0x12, 0x34, 0, 0, 0, 0]);
    dataview.setInt16(4, -1);
    assert.arrayEqual(uint8array, [0xff, 0xff, 0x12, 0x34, 0xff, 0xff, 0, 0]);
    dataview.setUint32(1, 0x12345678);
    assert.arrayEqual(uint8array, [0xff, 0x12, 0x34, 0x56, 0x78, 0xff, 0, 0]);
    dataview.setInt32(4, -2023406815);
    assert.arrayEqual(uint8array, [0xff, 0x12, 0x34, 0x56, 0x87, 0x65, 0x43, 0x21]);
    dataview.setFloat32(2, 1.2e+38);
    assert.arrayEqual(uint8array, [0xff, 0x12, 0x7e, 0xb4, 0x8e, 0x52, 0x43, 0x21]);
github zloirock / core-js / tests / pure / es.typed.conversions.uint8-clamped.js View on Github external
if (DESCRIPTORS) QUnit.test('Uint8Clamped conversions', assert => {
  const uint8clamped = new Uint8ClampedArray(1);
  const uint8array = new Uint8Array(uint8clamped.buffer);

  function toString(it) {
    return it === 0 && 1 / it === -Infinity ? '-0' : it;
  }

  const data = [
    [0, 0, [0]],
    [-0, 0, [0]],
    [1, 1, [1]],
    [-1, 0, [0]],
    [1.1, 1, [1]],
    [-1.1, 0, [0]],
    [1.9, 2, [2]],
    [-1.9, 0, [0]],
    [127, 127, [127]],
    [-127, 0, [0]],
github zloirock / core-js / tests / pure / es.typed.conversions.float32.js View on Github external
function viewFrom(it) {
    return new DataView(new Uint8Array(it).buffer);
  }
  function toString(it) {
github zloirock / core-js / tests / pure / es.typed.conversions.uint32.js View on Github external
function viewFrom(it) {
    return new DataView(new Uint8Array(it).buffer);
  }
  function toString(it) {
github zloirock / core-js / tests / pure / es.typed.conversions.int8.js View on Github external
function viewFrom(it) {
    return new DataView(new Uint8Array(it).buffer);
  }
  function toString(it) {
github zloirock / core-js / tests / pure / es.typed.conversions.uint8.js View on Github external
function viewFrom(it) {
    return new DataView(new Uint8Array(it).buffer);
  }
  function toString(it) {