2016-03-25 20:03:49 +00:00
|
|
|
exports.print = function (obj) {
|
2020-03-20 20:28:31 +00:00
|
|
|
return obj.constructor.name;
|
|
|
|
};
|
2015-12-29 20:11:31 +00:00
|
|
|
|
2016-03-25 20:03:49 +00:00
|
|
|
exports.echo = function (obj) {
|
2020-03-20 20:28:31 +00:00
|
|
|
return obj;
|
|
|
|
};
|
2016-07-25 07:30:40 +00:00
|
|
|
|
2018-05-24 12:05:46 +00:00
|
|
|
const typedArrays = {
|
|
|
|
Int8Array,
|
|
|
|
Uint8Array,
|
|
|
|
Uint8ClampedArray,
|
|
|
|
Int16Array,
|
|
|
|
Uint16Array,
|
|
|
|
Int32Array,
|
|
|
|
Uint32Array,
|
|
|
|
Float32Array,
|
|
|
|
Float64Array
|
2020-03-20 20:28:31 +00:00
|
|
|
};
|
2018-05-24 12:05:46 +00:00
|
|
|
|
|
|
|
exports.typedArray = function (type, values) {
|
2020-03-20 20:28:31 +00:00
|
|
|
const constructor = typedArrays[type];
|
|
|
|
const array = new constructor(values.length);
|
2018-05-24 12:05:46 +00:00
|
|
|
for (let i = 0; i < values.length; ++i) {
|
2020-03-20 20:28:31 +00:00
|
|
|
array[i] = values[i];
|
2016-07-25 07:30:40 +00:00
|
|
|
}
|
2020-03-20 20:28:31 +00:00
|
|
|
return array;
|
|
|
|
};
|
2018-06-13 07:38:31 +00:00
|
|
|
|
|
|
|
exports.getNaN = function () {
|
2020-03-20 20:28:31 +00:00
|
|
|
return NaN;
|
|
|
|
};
|
2018-06-13 07:38:31 +00:00
|
|
|
|
|
|
|
exports.getInfinity = function () {
|
2020-03-20 20:28:31 +00:00
|
|
|
return Infinity;
|
|
|
|
};
|