You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

14 lines
480 B

import { float } from './float.js';
import { array } from './array.js';
import { Float32Array } from '../utils/globals.js';
function toTypedMapper(data) {
return Float32Array.from(data);
}
function fromTypedUnmapper(value) {
if (!(value instanceof Float32Array))
throw new Error('Unexpected type');
return [...value];
}
export function float32Array(constraints = {}) {
return array(float(constraints), constraints).map(toTypedMapper, fromTypedUnmapper);
}