electron/spec/fixtures/module/print_name.js

29 lines
500 B
JavaScript
Raw Normal View History

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