Node-Red configuration
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

esnext.uint8-array.to-hex.js 809B

1234567891011121314151617181920212223
  1. 'use strict';
  2. var $ = require('../internals/export');
  3. var globalThis = require('../internals/global-this');
  4. var uncurryThis = require('../internals/function-uncurry-this');
  5. var anUint8Array = require('../internals/an-uint8-array');
  6. var notDetached = require('../internals/array-buffer-not-detached');
  7. var numberToString = uncurryThis(1.0.toString);
  8. // `Uint8Array.prototype.toHex` method
  9. // https://github.com/tc39/proposal-arraybuffer-base64
  10. if (globalThis.Uint8Array) $({ target: 'Uint8Array', proto: true }, {
  11. toHex: function toHex() {
  12. anUint8Array(this);
  13. notDetached(this.buffer);
  14. var result = '';
  15. for (var i = 0, length = this.length; i < length; i++) {
  16. var hex = numberToString(this[i], 16);
  17. result += hex.length === 1 ? '0' + hex : hex;
  18. }
  19. return result;
  20. }
  21. });