electron/spec-main/fixtures/module/print_name.js

37 lines
618 B
JavaScript
Raw Normal View History

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
const typedArrays = {
Int8Array,
Uint8Array,
Uint8ClampedArray,
Int16Array,
Uint16Array,
Int32Array,
Uint32Array,
Float32Array,
Float64Array
2020-03-20 20:28:31 +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);
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;
};
exports.getNaN = function () {
2020-03-20 20:28:31 +00:00
return NaN;
};
exports.getInfinity = function () {
2020-03-20 20:28:31 +00:00
return Infinity;
};