main
Last change
on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 4 days ago |
F4 Finalna Verzija
|
-
Property mode
set to
100644
|
File size:
809 bytes
|
Line | |
---|
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 |
|
---|
8 | var numberToString = uncurryThis(1.0.toString);
|
---|
9 |
|
---|
10 | // `Uint8Array.prototype.toHex` method
|
---|
11 | // https://github.com/tc39/proposal-arraybuffer-base64
|
---|
12 | if (globalThis.Uint8Array) $({ target: 'Uint8Array', proto: true }, {
|
---|
13 | toHex: function toHex() {
|
---|
14 | anUint8Array(this);
|
---|
15 | notDetached(this.buffer);
|
---|
16 | var result = '';
|
---|
17 | for (var i = 0, length = this.length; i < length; i++) {
|
---|
18 | var hex = numberToString(this[i], 16);
|
---|
19 | result += hex.length === 1 ? '0' + hex : hex;
|
---|
20 | }
|
---|
21 | return result;
|
---|
22 | }
|
---|
23 | });
|
---|
Note:
See
TracBrowser
for help on using the repository browser.