@iota/signing
Version:
IOTA Signing Scheme
74 lines • 2.44 kB
JavaScript
;
if (!Int8Array.prototype.slice) {
Object.defineProperty(Int8Array.prototype, 'slice', {
value: Array.prototype.slice
});
}
if (!Int8Array.prototype.subarray) {
Object.defineProperty(Uint8Array.prototype, 'subarray', {
value: Array.prototype.slice
});
}
if (!Int8Array.prototype.map) {
Object.defineProperty(Int8Array.prototype, 'map', {
value: Array.prototype.map
});
}
if (!Int8Array.prototype.every) {
Object.defineProperty(Int8Array.prototype, 'every', {
value: Array.prototype.every
});
}
if (!Int8Array.prototype.some) {
Object.defineProperty(Uint8Array.prototype, 'some', {
value: Array.prototype.some
});
}
if (!Int8Array.prototype.indexOf) {
Object.defineProperty(Int8Array.prototype, 'indexOf', {
value: Array.prototype.indexOf
});
}
// Source: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/fill#Polyfill
// Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/
if (!Int8Array.prototype.fill) {
Object.defineProperty(Int8Array.prototype, 'fill', {
value: function (input) {
// Steps 1-2.
if (this == null) {
throw new TypeError('this is null or not defined');
}
var O = Object(this);
// Steps 3-5.
var len = O.length >>> 0;
// Steps 6-7.
var start = arguments[1];
var relativeStart = start >> 0;
// Step 8.
var k = relativeStart < 0 ? Math.max(len + relativeStart, 0) : Math.min(relativeStart, len);
// Steps 9-10.
var end = arguments[2];
var relativeEnd = end === undefined ? len : end >> 0;
// Step 11.
var last = relativeEnd < 0 ? Math.max(len + relativeEnd, 0) : Math.min(relativeEnd, len);
// Step 12.
while (k < last) {
O[k] = input;
k++;
}
// Step 13.
return O;
}
});
}
if (!Uint32Array.prototype.slice) {
Object.defineProperty(Uint8Array.prototype, 'slice', {
value: Array.prototype.slice
});
}
if (!Uint32Array.prototype.reverse) {
Object.defineProperty(Uint8Array.prototype, 'reverse', {
value: Array.prototype.reverse
});
}
//# sourceMappingURL=typed-array.js.map