Projektstart
This commit is contained in:
216
backend/node_modules/mnemonist/utils/binary-search.js
generated
vendored
Normal file
216
backend/node_modules/mnemonist/utils/binary-search.js
generated
vendored
Normal file
@@ -0,0 +1,216 @@
|
||||
/**
|
||||
* Mnemonist Binary Search Helpers
|
||||
* ================================
|
||||
*
|
||||
* Typical binary search functions.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Function returning the index of the search value in the array or `-1` if
|
||||
* not found.
|
||||
*
|
||||
* @param {array} array - Haystack.
|
||||
* @param {any} value - Needle.
|
||||
* @return {number}
|
||||
*/
|
||||
exports.search = function(array, value, lo, hi) {
|
||||
var mid = 0;
|
||||
|
||||
lo = typeof lo !== 'undefined' ? lo : 0;
|
||||
hi = typeof hi !== 'undefined' ? hi : array.length;
|
||||
|
||||
hi--;
|
||||
|
||||
var current;
|
||||
|
||||
while (lo <= hi) {
|
||||
mid = (lo + hi) >>> 1;
|
||||
|
||||
current = array[mid];
|
||||
|
||||
if (current > value) {
|
||||
hi = ~-mid;
|
||||
}
|
||||
else if (current < value) {
|
||||
lo = -~mid;
|
||||
}
|
||||
else {
|
||||
return mid;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
};
|
||||
|
||||
/**
|
||||
* Same as above, but can use a custom comparator function.
|
||||
*
|
||||
* @param {function} comparator - Custom comparator function.
|
||||
* @param {array} array - Haystack.
|
||||
* @param {any} value - Needle.
|
||||
* @return {number}
|
||||
*/
|
||||
exports.searchWithComparator = function(comparator, array, value) {
|
||||
var mid = 0,
|
||||
lo = 0,
|
||||
hi = ~-array.length,
|
||||
comparison;
|
||||
|
||||
while (lo <= hi) {
|
||||
mid = (lo + hi) >>> 1;
|
||||
|
||||
comparison = comparator(array[mid], value);
|
||||
|
||||
if (comparison > 0) {
|
||||
hi = ~-mid;
|
||||
}
|
||||
else if (comparison < 0) {
|
||||
lo = -~mid;
|
||||
}
|
||||
else {
|
||||
return mid;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
};
|
||||
|
||||
/**
|
||||
* Function returning the lower bound of the given value in the array.
|
||||
*
|
||||
* @param {array} array - Haystack.
|
||||
* @param {any} value - Needle.
|
||||
* @param {number} [lo] - Start index.
|
||||
* @param {numner} [hi] - End index.
|
||||
* @return {number}
|
||||
*/
|
||||
exports.lowerBound = function(array, value, lo, hi) {
|
||||
var mid = 0;
|
||||
|
||||
lo = typeof lo !== 'undefined' ? lo : 0;
|
||||
hi = typeof hi !== 'undefined' ? hi : array.length;
|
||||
|
||||
while (lo < hi) {
|
||||
mid = (lo + hi) >>> 1;
|
||||
|
||||
if (value <= array[mid]) {
|
||||
hi = mid;
|
||||
}
|
||||
else {
|
||||
lo = -~mid;
|
||||
}
|
||||
}
|
||||
|
||||
return lo;
|
||||
};
|
||||
|
||||
/**
|
||||
* Same as above, but can use a custom comparator function.
|
||||
*
|
||||
* @param {function} comparator - Custom comparator function.
|
||||
* @param {array} array - Haystack.
|
||||
* @param {any} value - Needle.
|
||||
* @return {number}
|
||||
*/
|
||||
exports.lowerBoundWithComparator = function(comparator, array, value) {
|
||||
var mid = 0,
|
||||
lo = 0,
|
||||
hi = array.length;
|
||||
|
||||
while (lo < hi) {
|
||||
mid = (lo + hi) >>> 1;
|
||||
|
||||
if (comparator(value, array[mid]) <= 0) {
|
||||
hi = mid;
|
||||
}
|
||||
else {
|
||||
lo = -~mid;
|
||||
}
|
||||
}
|
||||
|
||||
return lo;
|
||||
};
|
||||
|
||||
/**
|
||||
* Same as above, but can work on sorted indices.
|
||||
*
|
||||
* @param {array} array - Haystack.
|
||||
* @param {array} array - Indices.
|
||||
* @param {any} value - Needle.
|
||||
* @return {number}
|
||||
*/
|
||||
exports.lowerBoundIndices = function(array, indices, value, lo, hi) {
|
||||
var mid = 0;
|
||||
|
||||
lo = typeof lo !== 'undefined' ? lo : 0;
|
||||
hi = typeof hi !== 'undefined' ? hi : array.length;
|
||||
|
||||
while (lo < hi) {
|
||||
mid = (lo + hi) >>> 1;
|
||||
|
||||
if (value <= array[indices[mid]]) {
|
||||
hi = mid;
|
||||
}
|
||||
else {
|
||||
lo = -~mid;
|
||||
}
|
||||
}
|
||||
|
||||
return lo;
|
||||
};
|
||||
|
||||
/**
|
||||
* Function returning the upper bound of the given value in the array.
|
||||
*
|
||||
* @param {array} array - Haystack.
|
||||
* @param {any} value - Needle.
|
||||
* @param {number} [lo] - Start index.
|
||||
* @param {numner} [hi] - End index.
|
||||
* @return {number}
|
||||
*/
|
||||
exports.upperBound = function(array, value, lo, hi) {
|
||||
var mid = 0;
|
||||
|
||||
lo = typeof lo !== 'undefined' ? lo : 0;
|
||||
hi = typeof hi !== 'undefined' ? hi : array.length;
|
||||
|
||||
while (lo < hi) {
|
||||
mid = (lo + hi) >>> 1;
|
||||
|
||||
if (value >= array[mid]) {
|
||||
lo = -~mid;
|
||||
}
|
||||
else {
|
||||
hi = mid;
|
||||
}
|
||||
}
|
||||
|
||||
return lo;
|
||||
};
|
||||
|
||||
/**
|
||||
* Same as above, but can use a custom comparator function.
|
||||
*
|
||||
* @param {function} comparator - Custom comparator function.
|
||||
* @param {array} array - Haystack.
|
||||
* @param {any} value - Needle.
|
||||
* @return {number}
|
||||
*/
|
||||
exports.upperBoundWithComparator = function(comparator, array, value) {
|
||||
var mid = 0,
|
||||
lo = 0,
|
||||
hi = array.length;
|
||||
|
||||
while (lo < hi) {
|
||||
mid = (lo + hi) >>> 1;
|
||||
|
||||
if (comparator(value, array[mid]) >= 0) {
|
||||
lo = -~mid;
|
||||
}
|
||||
else {
|
||||
hi = mid;
|
||||
}
|
||||
}
|
||||
|
||||
return lo;
|
||||
};
|
||||
109
backend/node_modules/mnemonist/utils/bitwise.js
generated
vendored
Normal file
109
backend/node_modules/mnemonist/utils/bitwise.js
generated
vendored
Normal file
@@ -0,0 +1,109 @@
|
||||
/**
|
||||
* Mnemonist Bitwise Helpers
|
||||
* ==========================
|
||||
*
|
||||
* Miscellaneous helpers helping with bitwise operations.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Takes a 32 bits integer and returns its MSB using SWAR strategy.
|
||||
*
|
||||
* @param {number} x - Target number.
|
||||
* @return {number}
|
||||
*/
|
||||
function msb32(x) {
|
||||
x |= (x >> 1);
|
||||
x |= (x >> 2);
|
||||
x |= (x >> 4);
|
||||
x |= (x >> 8);
|
||||
x |= (x >> 16);
|
||||
|
||||
return (x & ~(x >> 1));
|
||||
}
|
||||
exports.msb32 = msb32;
|
||||
|
||||
/**
|
||||
* Takes a byte and returns its MSB using SWAR strategy.
|
||||
*
|
||||
* @param {number} x - Target number.
|
||||
* @return {number}
|
||||
*/
|
||||
function msb8(x) {
|
||||
x |= (x >> 1);
|
||||
x |= (x >> 2);
|
||||
x |= (x >> 4);
|
||||
|
||||
return (x & ~(x >> 1));
|
||||
}
|
||||
exports.msb8 = msb8;
|
||||
|
||||
/**
|
||||
* Takes a number and return bit at position.
|
||||
*
|
||||
* @param {number} x - Target number.
|
||||
* @param {number} pos - Position.
|
||||
* @return {number}
|
||||
*/
|
||||
exports.test = function(x, pos) {
|
||||
return (x >> pos) & 1;
|
||||
};
|
||||
|
||||
/**
|
||||
* Compare two bytes and return their critical bit.
|
||||
*
|
||||
* @param {number} a - First byte.
|
||||
* @param {number} b - Second byte.
|
||||
* @return {number}
|
||||
*/
|
||||
exports.criticalBit8 = function(a, b) {
|
||||
return msb8(a ^ b);
|
||||
};
|
||||
|
||||
exports.criticalBit8Mask = function(a, b) {
|
||||
return (~msb8(a ^ b) >>> 0) & 0xff;
|
||||
};
|
||||
|
||||
exports.testCriticalBit8 = function(x, mask) {
|
||||
return (1 + (x | mask)) >> 8;
|
||||
};
|
||||
|
||||
exports.criticalBit32Mask = function(a, b) {
|
||||
return (~msb32(a ^ b) >>> 0) & 0xffffffff;
|
||||
};
|
||||
|
||||
/**
|
||||
* Takes a 32 bits integer and returns its population count (number of 1 of
|
||||
* the binary representation).
|
||||
*
|
||||
* @param {number} x - Target number.
|
||||
* @return {number}
|
||||
*/
|
||||
exports.popcount = function(x) {
|
||||
x -= x >> 1 & 0x55555555;
|
||||
x = (x & 0x33333333) + (x >> 2 & 0x33333333);
|
||||
x = x + (x >> 4) & 0x0f0f0f0f;
|
||||
x += x >> 8;
|
||||
x += x >> 16;
|
||||
return x & 0x7f;
|
||||
};
|
||||
|
||||
/**
|
||||
* Slightly faster popcount function based on a precomputed table of 8bits
|
||||
* words.
|
||||
*
|
||||
* @param {number} x - Target number.
|
||||
* @return {number}
|
||||
*/
|
||||
var TABLE8 = new Uint8Array(Math.pow(2, 8));
|
||||
|
||||
for (var i = 0, l = TABLE8.length; i < l; i++)
|
||||
TABLE8[i] = exports.popcount(i);
|
||||
|
||||
exports.table8Popcount = function(x) {
|
||||
return (
|
||||
TABLE8[x & 0xff] +
|
||||
TABLE8[(x >> 8) & 0xff] +
|
||||
TABLE8[(x >> 16) & 0xff] +
|
||||
TABLE8[(x >> 24) & 0xff]
|
||||
);
|
||||
};
|
||||
79
backend/node_modules/mnemonist/utils/comparators.js
generated
vendored
Normal file
79
backend/node_modules/mnemonist/utils/comparators.js
generated
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
/**
|
||||
* Mnemonist Heap Comparators
|
||||
* ===========================
|
||||
*
|
||||
* Default comparators & functions dealing with comparators reversing etc.
|
||||
*/
|
||||
var DEFAULT_COMPARATOR = function(a, b) {
|
||||
if (a < b)
|
||||
return -1;
|
||||
if (a > b)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
};
|
||||
|
||||
var DEFAULT_REVERSE_COMPARATOR = function(a, b) {
|
||||
if (a < b)
|
||||
return 1;
|
||||
if (a > b)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* Function used to reverse a comparator.
|
||||
*/
|
||||
function reverseComparator(comparator) {
|
||||
return function(a, b) {
|
||||
return comparator(b, a);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Function returning a tuple comparator.
|
||||
*/
|
||||
function createTupleComparator(size) {
|
||||
if (size === 2) {
|
||||
return function(a, b) {
|
||||
if (a[0] < b[0])
|
||||
return -1;
|
||||
|
||||
if (a[0] > b[0])
|
||||
return 1;
|
||||
|
||||
if (a[1] < b[1])
|
||||
return -1;
|
||||
|
||||
if (a[1] > b[1])
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
};
|
||||
}
|
||||
|
||||
return function(a, b) {
|
||||
var i = 0;
|
||||
|
||||
while (i < size) {
|
||||
if (a[i] < b[i])
|
||||
return -1;
|
||||
|
||||
if (a[i] > b[i])
|
||||
return 1;
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Exporting.
|
||||
*/
|
||||
exports.DEFAULT_COMPARATOR = DEFAULT_COMPARATOR;
|
||||
exports.DEFAULT_REVERSE_COMPARATOR = DEFAULT_REVERSE_COMPARATOR;
|
||||
exports.reverseComparator = reverseComparator;
|
||||
exports.createTupleComparator = createTupleComparator;
|
||||
107
backend/node_modules/mnemonist/utils/hash-tables.js
generated
vendored
Normal file
107
backend/node_modules/mnemonist/utils/hash-tables.js
generated
vendored
Normal file
@@ -0,0 +1,107 @@
|
||||
/* eslint no-constant-condition: 0 */
|
||||
/**
|
||||
* Mnemonist Hashtable Helpers
|
||||
* ============================
|
||||
*
|
||||
* Miscellaneous helpers helper function dealing with hashtables.
|
||||
*/
|
||||
function jenkinsInt32(a) {
|
||||
|
||||
a = (a + 0x7ed55d16) + (a << 12);
|
||||
a = (a ^ 0xc761c23c) ^ (a >> 19);
|
||||
a = (a + 0x165667b1) + (a << 5);
|
||||
a = (a + 0xd3a2646c) ^ (a << 9);
|
||||
a = (a + 0xfd7046c5) + (a << 3);
|
||||
a = (a ^ 0xb55a4f09) ^ (a >> 16);
|
||||
|
||||
return a;
|
||||
}
|
||||
|
||||
function linearProbingGet(hash, keys, values, key) {
|
||||
var n = keys.length,
|
||||
j = hash(key) & (n - 1),
|
||||
i = j;
|
||||
|
||||
var c;
|
||||
|
||||
while (true) {
|
||||
c = keys[i];
|
||||
|
||||
if (c === key)
|
||||
return values[i];
|
||||
|
||||
else if (c === 0)
|
||||
return;
|
||||
|
||||
// Handling wrapping around
|
||||
i += 1;
|
||||
i %= n;
|
||||
|
||||
// Full turn
|
||||
if (i === j)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
function linearProbingHas(hash, keys, key) {
|
||||
var n = keys.length,
|
||||
j = hash(key) & (n - 1),
|
||||
i = j;
|
||||
|
||||
var c;
|
||||
|
||||
while (true) {
|
||||
c = keys[i];
|
||||
|
||||
if (c === key)
|
||||
return true;
|
||||
|
||||
else if (c === 0)
|
||||
return false;
|
||||
|
||||
// Handling wrapping around
|
||||
i += 1;
|
||||
i %= n;
|
||||
|
||||
// Full turn
|
||||
if (i === j)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function linearProbingSet(hash, keys, values, key, value) {
|
||||
var n = keys.length,
|
||||
j = hash(key) & (n - 1),
|
||||
i = j;
|
||||
|
||||
var c;
|
||||
|
||||
while (true) {
|
||||
c = keys[i];
|
||||
|
||||
if (c === 0 || c === key)
|
||||
break;
|
||||
|
||||
// Handling wrapping around
|
||||
i += 1;
|
||||
i %= n;
|
||||
|
||||
// Full turn
|
||||
if (i === j)
|
||||
throw new Error('mnemonist/utils/hash-tables.linearProbingSet: table is full.');
|
||||
}
|
||||
|
||||
keys[i] = key;
|
||||
values[i] = value;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
hashes: {
|
||||
jenkinsInt32: jenkinsInt32
|
||||
},
|
||||
linearProbing: {
|
||||
get: linearProbingGet,
|
||||
has: linearProbingHas,
|
||||
set: linearProbingSet
|
||||
}
|
||||
};
|
||||
93
backend/node_modules/mnemonist/utils/iterables.js
generated
vendored
Normal file
93
backend/node_modules/mnemonist/utils/iterables.js
generated
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
/**
|
||||
* Mnemonist Iterable Function
|
||||
* ============================
|
||||
*
|
||||
* Harmonized iteration helpers over mixed iterable targets.
|
||||
*/
|
||||
var forEach = require('obliterator/foreach');
|
||||
|
||||
var typed = require('./typed-arrays.js');
|
||||
|
||||
/**
|
||||
* Function used to determine whether the given object supports array-like
|
||||
* random access.
|
||||
*
|
||||
* @param {any} target - Target object.
|
||||
* @return {boolean}
|
||||
*/
|
||||
function isArrayLike(target) {
|
||||
return Array.isArray(target) || typed.isTypedArray(target);
|
||||
}
|
||||
|
||||
/**
|
||||
* Function used to guess the length of the structure over which we are going
|
||||
* to iterate.
|
||||
*
|
||||
* @param {any} target - Target object.
|
||||
* @return {number|undefined}
|
||||
*/
|
||||
function guessLength(target) {
|
||||
if (typeof target.length === 'number')
|
||||
return target.length;
|
||||
|
||||
if (typeof target.size === 'number')
|
||||
return target.size;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function used to convert an iterable to an array.
|
||||
*
|
||||
* @param {any} target - Iteration target.
|
||||
* @return {array}
|
||||
*/
|
||||
function toArray(target) {
|
||||
var l = guessLength(target);
|
||||
|
||||
var array = typeof l === 'number' ? new Array(l) : [];
|
||||
|
||||
var i = 0;
|
||||
|
||||
// TODO: we could optimize when given target is array like
|
||||
forEach(target, function(value) {
|
||||
array[i++] = value;
|
||||
});
|
||||
|
||||
return array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Same as above but returns a supplementary indices array.
|
||||
*
|
||||
* @param {any} target - Iteration target.
|
||||
* @return {array}
|
||||
*/
|
||||
function toArrayWithIndices(target) {
|
||||
var l = guessLength(target);
|
||||
|
||||
var IndexArray = typeof l === 'number' ?
|
||||
typed.getPointerArray(l) :
|
||||
Array;
|
||||
|
||||
var array = typeof l === 'number' ? new Array(l) : [];
|
||||
var indices = typeof l === 'number' ? new IndexArray(l) : [];
|
||||
|
||||
var i = 0;
|
||||
|
||||
// TODO: we could optimize when given target is array like
|
||||
forEach(target, function(value) {
|
||||
array[i] = value;
|
||||
indices[i] = i++;
|
||||
});
|
||||
|
||||
return [array, indices];
|
||||
}
|
||||
|
||||
/**
|
||||
* Exporting.
|
||||
*/
|
||||
exports.isArrayLike = isArrayLike;
|
||||
exports.guessLength = guessLength;
|
||||
exports.toArray = toArray;
|
||||
exports.toArrayWithIndices = toArrayWithIndices;
|
||||
563
backend/node_modules/mnemonist/utils/merge.js
generated
vendored
Normal file
563
backend/node_modules/mnemonist/utils/merge.js
generated
vendored
Normal file
@@ -0,0 +1,563 @@
|
||||
/* eslint no-constant-condition: 0 */
|
||||
/**
|
||||
* Mnemonist Merge Helpers
|
||||
* ========================
|
||||
*
|
||||
* Various merge algorithms used to handle sorted lists. Note that the given
|
||||
* functions are optimized and won't accept mixed arguments.
|
||||
*
|
||||
* Note: maybe this piece of code belong to sortilege, along with binary-search.
|
||||
*/
|
||||
var typed = require('./typed-arrays.js'),
|
||||
isArrayLike = require('./iterables.js').isArrayLike,
|
||||
binarySearch = require('./binary-search.js'),
|
||||
FibonacciHeap = require('../fibonacci-heap.js');
|
||||
|
||||
// TODO: update to use exponential search
|
||||
// TODO: when not knowing final length => should use plain arrays rather than
|
||||
// same type as input
|
||||
|
||||
/**
|
||||
* Merge two sorted array-like structures into one.
|
||||
*
|
||||
* @param {array} a - First array.
|
||||
* @param {array} b - Second array.
|
||||
* @return {array}
|
||||
*/
|
||||
function mergeArrays(a, b) {
|
||||
|
||||
// One of the arrays is empty
|
||||
if (a.length === 0)
|
||||
return b.slice();
|
||||
if (b.length === 0)
|
||||
return a.slice();
|
||||
|
||||
// Finding min array
|
||||
var tmp;
|
||||
|
||||
if (a[0] > b[0]) {
|
||||
tmp = a;
|
||||
a = b;
|
||||
b = tmp;
|
||||
}
|
||||
|
||||
// If array have non overlapping ranges, we can just concatenate them
|
||||
var aEnd = a[a.length - 1],
|
||||
bStart = b[0];
|
||||
|
||||
if (aEnd <= bStart) {
|
||||
if (typed.isTypedArray(a))
|
||||
return typed.concat(a, b);
|
||||
return a.concat(b);
|
||||
}
|
||||
|
||||
// Initializing target
|
||||
var array = new a.constructor(a.length + b.length);
|
||||
|
||||
// Iterating until we overlap
|
||||
var i, l, v;
|
||||
|
||||
for (i = 0, l = a.length; i < l; i++) {
|
||||
v = a[i];
|
||||
|
||||
if (v <= bStart)
|
||||
array[i] = v;
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
// Handling overlap
|
||||
var aPointer = i,
|
||||
aLength = a.length,
|
||||
bPointer = 0,
|
||||
bLength = b.length,
|
||||
aHead,
|
||||
bHead;
|
||||
|
||||
while (aPointer < aLength && bPointer < bLength) {
|
||||
aHead = a[aPointer];
|
||||
bHead = b[bPointer];
|
||||
|
||||
if (aHead <= bHead) {
|
||||
array[i++] = aHead;
|
||||
aPointer++;
|
||||
}
|
||||
else {
|
||||
array[i++] = bHead;
|
||||
bPointer++;
|
||||
}
|
||||
}
|
||||
|
||||
// Filling
|
||||
while (aPointer < aLength)
|
||||
array[i++] = a[aPointer++];
|
||||
while (bPointer < bLength)
|
||||
array[i++] = b[bPointer++];
|
||||
|
||||
return array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform the union of two already unique sorted array-like structures into one.
|
||||
*
|
||||
* @param {array} a - First array.
|
||||
* @param {array} b - Second array.
|
||||
* @return {array}
|
||||
*/
|
||||
function unionUniqueArrays(a, b) {
|
||||
|
||||
// One of the arrays is empty
|
||||
if (a.length === 0)
|
||||
return b.slice();
|
||||
if (b.length === 0)
|
||||
return a.slice();
|
||||
|
||||
// Finding min array
|
||||
var tmp;
|
||||
|
||||
if (a[0] > b[0]) {
|
||||
tmp = a;
|
||||
a = b;
|
||||
b = tmp;
|
||||
}
|
||||
|
||||
// If array have non overlapping ranges, we can just concatenate them
|
||||
var aEnd = a[a.length - 1],
|
||||
bStart = b[0];
|
||||
|
||||
if (aEnd < bStart) {
|
||||
if (typed.isTypedArray(a))
|
||||
return typed.concat(a, b);
|
||||
return a.concat(b);
|
||||
}
|
||||
|
||||
// Initializing target
|
||||
var array = new a.constructor();
|
||||
|
||||
// Iterating until we overlap
|
||||
var i, l, v;
|
||||
|
||||
for (i = 0, l = a.length; i < l; i++) {
|
||||
v = a[i];
|
||||
|
||||
if (v < bStart)
|
||||
array.push(v);
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
// Handling overlap
|
||||
var aPointer = i,
|
||||
aLength = a.length,
|
||||
bPointer = 0,
|
||||
bLength = b.length,
|
||||
aHead,
|
||||
bHead;
|
||||
|
||||
while (aPointer < aLength && bPointer < bLength) {
|
||||
aHead = a[aPointer];
|
||||
bHead = b[bPointer];
|
||||
|
||||
if (aHead <= bHead) {
|
||||
|
||||
if (array.length === 0 || array[array.length - 1] !== aHead)
|
||||
array.push(aHead);
|
||||
|
||||
aPointer++;
|
||||
}
|
||||
else {
|
||||
if (array.length === 0 || array[array.length - 1] !== bHead)
|
||||
array.push(bHead);
|
||||
|
||||
bPointer++;
|
||||
}
|
||||
}
|
||||
|
||||
// Filling
|
||||
// TODO: it's possible to optimize a bit here, since the condition is only
|
||||
// relevant the first time
|
||||
while (aPointer < aLength) {
|
||||
aHead = a[aPointer++];
|
||||
|
||||
if (array.length === 0 || array[array.length - 1] !== aHead)
|
||||
array.push(aHead);
|
||||
}
|
||||
while (bPointer < bLength) {
|
||||
bHead = b[bPointer++];
|
||||
|
||||
if (array.length === 0 || array[array.length - 1] !== bHead)
|
||||
array.push(bHead);
|
||||
}
|
||||
|
||||
return array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform the intersection of two already unique sorted array-like structures into one.
|
||||
*
|
||||
* @param {array} a - First array.
|
||||
* @param {array} b - Second array.
|
||||
* @return {array}
|
||||
*/
|
||||
exports.intersectionUniqueArrays = function(a, b) {
|
||||
|
||||
// One of the arrays is empty
|
||||
if (a.length === 0 || b.length === 0)
|
||||
return new a.constructor(0);
|
||||
|
||||
// Finding min array
|
||||
var tmp;
|
||||
|
||||
if (a[0] > b[0]) {
|
||||
tmp = a;
|
||||
a = b;
|
||||
b = tmp;
|
||||
}
|
||||
|
||||
// If array have non overlapping ranges, there is no intersection
|
||||
var aEnd = a[a.length - 1],
|
||||
bStart = b[0];
|
||||
|
||||
if (aEnd < bStart)
|
||||
return new a.constructor(0);
|
||||
|
||||
// Initializing target
|
||||
var array = new a.constructor();
|
||||
|
||||
// Handling overlap
|
||||
var aPointer = binarySearch.lowerBound(a, bStart),
|
||||
aLength = a.length,
|
||||
bPointer = 0,
|
||||
bLength = binarySearch.upperBound(b, aEnd),
|
||||
aHead,
|
||||
bHead;
|
||||
|
||||
while (aPointer < aLength && bPointer < bLength) {
|
||||
aHead = a[aPointer];
|
||||
bHead = b[bPointer];
|
||||
|
||||
if (aHead < bHead) {
|
||||
aPointer = binarySearch.lowerBound(a, bHead, aPointer + 1);
|
||||
}
|
||||
else if (aHead > bHead) {
|
||||
bPointer = binarySearch.lowerBound(b, aHead, bPointer + 1);
|
||||
}
|
||||
else {
|
||||
array.push(aHead);
|
||||
aPointer++;
|
||||
bPointer++;
|
||||
}
|
||||
}
|
||||
|
||||
return array;
|
||||
};
|
||||
|
||||
/**
|
||||
* Merge k sorted array-like structures into one.
|
||||
*
|
||||
* @param {array<array>} arrays - Arrays to merge.
|
||||
* @return {array}
|
||||
*/
|
||||
function kWayMergeArrays(arrays) {
|
||||
var length = 0,
|
||||
max = -Infinity,
|
||||
al,
|
||||
i,
|
||||
l;
|
||||
|
||||
var filtered = [];
|
||||
|
||||
for (i = 0, l = arrays.length; i < l; i++) {
|
||||
al = arrays[i].length;
|
||||
|
||||
if (al === 0)
|
||||
continue;
|
||||
|
||||
filtered.push(arrays[i]);
|
||||
|
||||
length += al;
|
||||
|
||||
if (al > max)
|
||||
max = al;
|
||||
}
|
||||
|
||||
if (filtered.length === 0)
|
||||
return new arrays[0].constructor(0);
|
||||
|
||||
if (filtered.length === 1)
|
||||
return filtered[0].slice();
|
||||
|
||||
if (filtered.length === 2)
|
||||
return mergeArrays(filtered[0], filtered[1]);
|
||||
|
||||
arrays = filtered;
|
||||
|
||||
var array = new arrays[0].constructor(length);
|
||||
|
||||
var PointerArray = typed.getPointerArray(max);
|
||||
|
||||
var pointers = new PointerArray(arrays.length);
|
||||
|
||||
// TODO: benchmark vs. a binomial heap
|
||||
var heap = new FibonacciHeap(function(a, b) {
|
||||
a = arrays[a][pointers[a]];
|
||||
b = arrays[b][pointers[b]];
|
||||
|
||||
if (a < b)
|
||||
return -1;
|
||||
|
||||
if (a > b)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
});
|
||||
|
||||
for (i = 0; i < l; i++)
|
||||
heap.push(i);
|
||||
|
||||
i = 0;
|
||||
|
||||
var p,
|
||||
v;
|
||||
|
||||
while (heap.size) {
|
||||
p = heap.pop();
|
||||
v = arrays[p][pointers[p]++];
|
||||
array[i++] = v;
|
||||
|
||||
if (pointers[p] < arrays[p].length)
|
||||
heap.push(p);
|
||||
}
|
||||
|
||||
return array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform the union of k sorted unique array-like structures into one.
|
||||
*
|
||||
* @param {array<array>} arrays - Arrays to merge.
|
||||
* @return {array}
|
||||
*/
|
||||
function kWayUnionUniqueArrays(arrays) {
|
||||
var max = -Infinity,
|
||||
al,
|
||||
i,
|
||||
l;
|
||||
|
||||
var filtered = [];
|
||||
|
||||
for (i = 0, l = arrays.length; i < l; i++) {
|
||||
al = arrays[i].length;
|
||||
|
||||
if (al === 0)
|
||||
continue;
|
||||
|
||||
filtered.push(arrays[i]);
|
||||
|
||||
if (al > max)
|
||||
max = al;
|
||||
}
|
||||
|
||||
if (filtered.length === 0)
|
||||
return new arrays[0].constructor(0);
|
||||
|
||||
if (filtered.length === 1)
|
||||
return filtered[0].slice();
|
||||
|
||||
if (filtered.length === 2)
|
||||
return unionUniqueArrays(filtered[0], filtered[1]);
|
||||
|
||||
arrays = filtered;
|
||||
|
||||
var array = new arrays[0].constructor();
|
||||
|
||||
var PointerArray = typed.getPointerArray(max);
|
||||
|
||||
var pointers = new PointerArray(arrays.length);
|
||||
|
||||
// TODO: benchmark vs. a binomial heap
|
||||
var heap = new FibonacciHeap(function(a, b) {
|
||||
a = arrays[a][pointers[a]];
|
||||
b = arrays[b][pointers[b]];
|
||||
|
||||
if (a < b)
|
||||
return -1;
|
||||
|
||||
if (a > b)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
});
|
||||
|
||||
for (i = 0; i < l; i++)
|
||||
heap.push(i);
|
||||
|
||||
var p,
|
||||
v;
|
||||
|
||||
while (heap.size) {
|
||||
p = heap.pop();
|
||||
v = arrays[p][pointers[p]++];
|
||||
|
||||
if (array.length === 0 || array[array.length - 1] !== v)
|
||||
array.push(v);
|
||||
|
||||
if (pointers[p] < arrays[p].length)
|
||||
heap.push(p);
|
||||
}
|
||||
|
||||
return array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform the intersection of k sorted array-like structures into one.
|
||||
*
|
||||
* @param {array<array>} arrays - Arrays to merge.
|
||||
* @return {array}
|
||||
*/
|
||||
exports.kWayIntersectionUniqueArrays = function(arrays) {
|
||||
var max = -Infinity,
|
||||
maxStart = -Infinity,
|
||||
minEnd = Infinity,
|
||||
first,
|
||||
last,
|
||||
al,
|
||||
i,
|
||||
l;
|
||||
|
||||
for (i = 0, l = arrays.length; i < l; i++) {
|
||||
al = arrays[i].length;
|
||||
|
||||
// If one of the arrays is empty, so is the intersection
|
||||
if (al === 0)
|
||||
return [];
|
||||
|
||||
if (al > max)
|
||||
max = al;
|
||||
|
||||
first = arrays[i][0];
|
||||
last = arrays[i][al - 1];
|
||||
|
||||
if (first > maxStart)
|
||||
maxStart = first;
|
||||
|
||||
if (last < minEnd)
|
||||
minEnd = last;
|
||||
}
|
||||
|
||||
// Full overlap is impossible
|
||||
if (maxStart > minEnd)
|
||||
return [];
|
||||
|
||||
// Only one value
|
||||
if (maxStart === minEnd)
|
||||
return [maxStart];
|
||||
|
||||
// NOTE: trying to outsmart I(D,I(C,I(A,B))) is pointless unfortunately...
|
||||
// NOTE: I tried to be very clever about bounds but it does not seem
|
||||
// to improve the performance of the algorithm.
|
||||
var a, b,
|
||||
array = arrays[0],
|
||||
aPointer,
|
||||
bPointer,
|
||||
aLimit,
|
||||
bLimit,
|
||||
aHead,
|
||||
bHead,
|
||||
start = maxStart;
|
||||
|
||||
for (i = 1; i < l; i++) {
|
||||
a = array;
|
||||
b = arrays[i];
|
||||
|
||||
// Change that to `[]` and observe some perf drops on V8...
|
||||
array = new Array();
|
||||
|
||||
aPointer = 0;
|
||||
bPointer = binarySearch.lowerBound(b, start);
|
||||
|
||||
aLimit = a.length;
|
||||
bLimit = b.length;
|
||||
|
||||
while (aPointer < aLimit && bPointer < bLimit) {
|
||||
aHead = a[aPointer];
|
||||
bHead = b[bPointer];
|
||||
|
||||
if (aHead < bHead) {
|
||||
aPointer = binarySearch.lowerBound(a, bHead, aPointer + 1);
|
||||
}
|
||||
else if (aHead > bHead) {
|
||||
bPointer = binarySearch.lowerBound(b, aHead, bPointer + 1);
|
||||
}
|
||||
else {
|
||||
array.push(aHead);
|
||||
aPointer++;
|
||||
bPointer++;
|
||||
}
|
||||
}
|
||||
|
||||
if (array.length === 0)
|
||||
return array;
|
||||
|
||||
start = array[0];
|
||||
}
|
||||
|
||||
return array;
|
||||
};
|
||||
|
||||
/**
|
||||
* Variadic merging all of the given arrays.
|
||||
*
|
||||
* @param {...array}
|
||||
* @return {array}
|
||||
*/
|
||||
exports.merge = function() {
|
||||
if (arguments.length === 2) {
|
||||
if (isArrayLike(arguments[0]))
|
||||
return mergeArrays(arguments[0], arguments[1]);
|
||||
}
|
||||
else {
|
||||
if (isArrayLike(arguments[0]))
|
||||
return kWayMergeArrays(arguments);
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Variadic function performing the union of all the given unique arrays.
|
||||
*
|
||||
* @param {...array}
|
||||
* @return {array}
|
||||
*/
|
||||
exports.unionUnique = function() {
|
||||
if (arguments.length === 2) {
|
||||
if (isArrayLike(arguments[0]))
|
||||
return unionUniqueArrays(arguments[0], arguments[1]);
|
||||
}
|
||||
else {
|
||||
if (isArrayLike(arguments[0]))
|
||||
return kWayUnionUniqueArrays(arguments);
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Variadic function performing the intersection of all the given unique arrays.
|
||||
*
|
||||
* @param {...array}
|
||||
* @return {array}
|
||||
*/
|
||||
exports.intersectionUnique = function() {
|
||||
if (arguments.length === 2) {
|
||||
if (isArrayLike(arguments[0]))
|
||||
return exports.intersectionUniqueArrays(arguments[0], arguments[1]);
|
||||
}
|
||||
else {
|
||||
if (isArrayLike(arguments[0]))
|
||||
return exports.kWayIntersectionUniqueArrays(arguments);
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
87
backend/node_modules/mnemonist/utils/murmurhash3.js
generated
vendored
Normal file
87
backend/node_modules/mnemonist/utils/murmurhash3.js
generated
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
/* eslint no-fallthrough: 0 */
|
||||
/**
|
||||
* Mnemonist MurmurHash 3
|
||||
* =======================
|
||||
*
|
||||
* Straightforward implementation of the third version of MurmurHash.
|
||||
*
|
||||
* Note: this piece of code belong to haschisch.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Various helpers.
|
||||
*/
|
||||
function mul32(a, b) {
|
||||
return (a & 0xffff) * b + (((a >>> 16) * b & 0xffff) << 16) & 0xffffffff;
|
||||
}
|
||||
|
||||
function sum32(a, b) {
|
||||
return (a & 0xffff) + (b >>> 16) + (((a >>> 16) + b & 0xffff) << 16) & 0xffffffff;
|
||||
}
|
||||
|
||||
function rotl32(a, b) {
|
||||
return (a << b) | (a >>> (32 - b));
|
||||
}
|
||||
|
||||
/**
|
||||
* MumurHash3 function.
|
||||
*
|
||||
* @param {number} seed - Seed.
|
||||
* @param {ByteArray} data - Data.
|
||||
*/
|
||||
module.exports = function murmurhash3(seed, data) {
|
||||
var c1 = 0xcc9e2d51,
|
||||
c2 = 0x1b873593,
|
||||
r1 = 15,
|
||||
r2 = 13,
|
||||
m = 5,
|
||||
n = 0x6b64e654;
|
||||
|
||||
var hash = seed,
|
||||
k1,
|
||||
i,
|
||||
l;
|
||||
|
||||
for (i = 0, l = data.length - 4; i <= l; i += 4) {
|
||||
k1 = (
|
||||
data[i] |
|
||||
(data[i + 1] << 8) |
|
||||
(data[i + 2] << 16) |
|
||||
(data[i + 3] << 24)
|
||||
);
|
||||
|
||||
k1 = mul32(k1, c1);
|
||||
k1 = rotl32(k1, r1);
|
||||
k1 = mul32(k1, c2);
|
||||
|
||||
hash ^= k1;
|
||||
hash = rotl32(hash, r2);
|
||||
hash = mul32(hash, m);
|
||||
hash = sum32(hash, n);
|
||||
}
|
||||
|
||||
k1 = 0;
|
||||
|
||||
switch (data.length & 3) {
|
||||
case 3:
|
||||
k1 ^= data[i + 2] << 16;
|
||||
case 2:
|
||||
k1 ^= data[i + 1] << 8;
|
||||
case 1:
|
||||
k1 ^= data[i];
|
||||
k1 = mul32(k1, c1);
|
||||
k1 = rotl32(k1, r1);
|
||||
k1 = mul32(k1, c2);
|
||||
hash ^= k1;
|
||||
default:
|
||||
}
|
||||
|
||||
hash ^= data.length;
|
||||
hash ^= hash >>> 16;
|
||||
hash = mul32(hash, 0x85ebca6b);
|
||||
hash ^= hash >>> 13;
|
||||
hash = mul32(hash, 0xc2b2ae35);
|
||||
hash ^= hash >>> 16;
|
||||
|
||||
return hash >>> 0;
|
||||
};
|
||||
10
backend/node_modules/mnemonist/utils/typed-arrays.d.ts
generated
vendored
Normal file
10
backend/node_modules/mnemonist/utils/typed-arrays.d.ts
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
export type PointerArray = Uint8Array | Uint16Array | Uint32Array | Float64Array;
|
||||
export type SignedPointerArray = Int8Array | Int16Array | Int32Array | Float64Array;
|
||||
export type PointerArrayConstructor = Uint8ArrayConstructor | Uint16ArrayConstructor | Uint32ArrayConstructor | Float64ArrayConstructor;
|
||||
export type SignedPointerArrayConstructor = Int8ArrayConstructor | Int16ArrayConstructor | Int32ArrayConstructor | Float64ArrayConstructor;
|
||||
|
||||
export function getPointerArray(size: number): PointerArrayConstructor;
|
||||
export function getSignedPointerArray(size: number): SignedPointerArrayConstructor;
|
||||
export function getNumberType(value: number): PointerArrayConstructor | SignedPointerArrayConstructor;
|
||||
export function isTypedArray(value: unknown): boolean;
|
||||
export function indices(length: number): PointerArray;
|
||||
187
backend/node_modules/mnemonist/utils/typed-arrays.js
generated
vendored
Normal file
187
backend/node_modules/mnemonist/utils/typed-arrays.js
generated
vendored
Normal file
@@ -0,0 +1,187 @@
|
||||
/**
|
||||
* Mnemonist Typed Array Helpers
|
||||
* ==============================
|
||||
*
|
||||
* Miscellaneous helpers related to typed arrays.
|
||||
*/
|
||||
|
||||
/**
|
||||
* When using an unsigned integer array to store pointers, one might want to
|
||||
* choose the optimal word size in regards to the actual numbers of pointers
|
||||
* to store.
|
||||
*
|
||||
* This helpers does just that.
|
||||
*
|
||||
* @param {number} size - Expected size of the array to map.
|
||||
* @return {TypedArray}
|
||||
*/
|
||||
var MAX_8BIT_INTEGER = Math.pow(2, 8) - 1,
|
||||
MAX_16BIT_INTEGER = Math.pow(2, 16) - 1,
|
||||
MAX_32BIT_INTEGER = Math.pow(2, 32) - 1;
|
||||
|
||||
var MAX_SIGNED_8BIT_INTEGER = Math.pow(2, 7) - 1,
|
||||
MAX_SIGNED_16BIT_INTEGER = Math.pow(2, 15) - 1,
|
||||
MAX_SIGNED_32BIT_INTEGER = Math.pow(2, 31) - 1;
|
||||
|
||||
exports.getPointerArray = function(size) {
|
||||
var maxIndex = size - 1;
|
||||
|
||||
if (maxIndex <= MAX_8BIT_INTEGER)
|
||||
return Uint8Array;
|
||||
|
||||
if (maxIndex <= MAX_16BIT_INTEGER)
|
||||
return Uint16Array;
|
||||
|
||||
if (maxIndex <= MAX_32BIT_INTEGER)
|
||||
return Uint32Array;
|
||||
|
||||
throw new Error('mnemonist: Pointer Array of size > 4294967295 is not supported.');
|
||||
};
|
||||
|
||||
exports.getSignedPointerArray = function(size) {
|
||||
var maxIndex = size - 1;
|
||||
|
||||
if (maxIndex <= MAX_SIGNED_8BIT_INTEGER)
|
||||
return Int8Array;
|
||||
|
||||
if (maxIndex <= MAX_SIGNED_16BIT_INTEGER)
|
||||
return Int16Array;
|
||||
|
||||
if (maxIndex <= MAX_SIGNED_32BIT_INTEGER)
|
||||
return Int32Array;
|
||||
|
||||
return Float64Array;
|
||||
};
|
||||
|
||||
/**
|
||||
* Function returning the minimal type able to represent the given number.
|
||||
*
|
||||
* @param {number} value - Value to test.
|
||||
* @return {TypedArrayClass}
|
||||
*/
|
||||
exports.getNumberType = function(value) {
|
||||
|
||||
// <= 32 bits itnteger?
|
||||
if (value === (value | 0)) {
|
||||
|
||||
// Negative
|
||||
if (Math.sign(value) === -1) {
|
||||
if (value <= 127 && value >= -128)
|
||||
return Int8Array;
|
||||
|
||||
if (value <= 32767 && value >= -32768)
|
||||
return Int16Array;
|
||||
|
||||
return Int32Array;
|
||||
}
|
||||
else {
|
||||
|
||||
if (value <= 255)
|
||||
return Uint8Array;
|
||||
|
||||
if (value <= 65535)
|
||||
return Uint16Array;
|
||||
|
||||
return Uint32Array;
|
||||
}
|
||||
}
|
||||
|
||||
// 53 bits integer & floats
|
||||
// NOTE: it's kinda hard to tell whether we could use 32bits or not...
|
||||
return Float64Array;
|
||||
};
|
||||
|
||||
/**
|
||||
* Function returning the minimal type able to represent the given array
|
||||
* of JavaScript numbers.
|
||||
*
|
||||
* @param {array} array - Array to represent.
|
||||
* @param {function} getter - Optional getter.
|
||||
* @return {TypedArrayClass}
|
||||
*/
|
||||
var TYPE_PRIORITY = {
|
||||
Uint8Array: 1,
|
||||
Int8Array: 2,
|
||||
Uint16Array: 3,
|
||||
Int16Array: 4,
|
||||
Uint32Array: 5,
|
||||
Int32Array: 6,
|
||||
Float32Array: 7,
|
||||
Float64Array: 8
|
||||
};
|
||||
|
||||
// TODO: make this a one-shot for one value
|
||||
exports.getMinimalRepresentation = function(array, getter) {
|
||||
var maxType = null,
|
||||
maxPriority = 0,
|
||||
p,
|
||||
t,
|
||||
v,
|
||||
i,
|
||||
l;
|
||||
|
||||
for (i = 0, l = array.length; i < l; i++) {
|
||||
v = getter ? getter(array[i]) : array[i];
|
||||
t = exports.getNumberType(v);
|
||||
p = TYPE_PRIORITY[t.name];
|
||||
|
||||
if (p > maxPriority) {
|
||||
maxPriority = p;
|
||||
maxType = t;
|
||||
}
|
||||
}
|
||||
|
||||
return maxType;
|
||||
};
|
||||
|
||||
/**
|
||||
* Function returning whether the given value is a typed array.
|
||||
*
|
||||
* @param {any} value - Value to test.
|
||||
* @return {boolean}
|
||||
*/
|
||||
exports.isTypedArray = function(value) {
|
||||
return typeof ArrayBuffer !== 'undefined' && ArrayBuffer.isView(value);
|
||||
};
|
||||
|
||||
/**
|
||||
* Function used to concat byte arrays.
|
||||
*
|
||||
* @param {...ByteArray}
|
||||
* @return {ByteArray}
|
||||
*/
|
||||
exports.concat = function() {
|
||||
var length = 0,
|
||||
i,
|
||||
o,
|
||||
l;
|
||||
|
||||
for (i = 0, l = arguments.length; i < l; i++)
|
||||
length += arguments[i].length;
|
||||
|
||||
var array = new (arguments[0].constructor)(length);
|
||||
|
||||
for (i = 0, o = 0; i < l; i++) {
|
||||
array.set(arguments[i], o);
|
||||
o += arguments[i].length;
|
||||
}
|
||||
|
||||
return array;
|
||||
};
|
||||
|
||||
/**
|
||||
* Function used to initialize a byte array of indices.
|
||||
*
|
||||
* @param {number} length - Length of target.
|
||||
* @return {ByteArray}
|
||||
*/
|
||||
exports.indices = function(length) {
|
||||
var PointerArray = exports.getPointerArray(length);
|
||||
|
||||
var array = new PointerArray(length);
|
||||
|
||||
for (var i = 0; i < length; i++)
|
||||
array[i] = i;
|
||||
|
||||
return array;
|
||||
};
|
||||
18
backend/node_modules/mnemonist/utils/types.d.ts
generated
vendored
Normal file
18
backend/node_modules/mnemonist/utils/types.d.ts
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* Mnemonist Generic Types
|
||||
* ========================
|
||||
*
|
||||
* Collection of types used throughout the library.
|
||||
*/
|
||||
export interface IArrayLike {
|
||||
length: number;
|
||||
slice(from: number, to?: number): IArrayLike;
|
||||
}
|
||||
|
||||
export type ArrayLike = IArrayLike | ArrayBuffer;
|
||||
|
||||
export interface IArrayLikeConstructor {
|
||||
new(...args: any[]): ArrayLike;
|
||||
}
|
||||
|
||||
export type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array;
|
||||
Reference in New Issue
Block a user