refactor: define globals

This commit is contained in:
Azgaar 2022-07-05 01:17:22 +03:00
parent 22903fcb71
commit 7c2c624417
26 changed files with 939 additions and 245 deletions

View file

@ -21,12 +21,10 @@ interface ICreateTypesArrayFrom {
export function createTypedArray(params: ICreateTypesArrayLength | ICreateTypesArrayFrom) {
const typedArray = getTypedArray(params.maxValue);
if ("from" in params) {
typedArray.from(params.from);
} else if ("length" in params) {
return new typedArray(params.length);
return typedArray.from(params.from);
}
return typedArray;
return new typedArray(params.length);
}
function getTypedArray(maxValue: number) {