Spaces:
Paused
Paused
Download node_modules/array-bounds/index.js from Leon4gr45/UserSyncFrontend: direct link, hf CLI and curl.
- Browser
- Download file 554 Bytes
-
https://huggingface.co/spaces/Leon4gr45/UserSyncFrontend/resolve/main/node_modules/array-bounds/index.js
- Command line
-
hf download hf://spaces/Leon4gr45/UserSyncFrontend/node_modules/array-bounds/index.js
-
curl -L -o index.js https://huggingface.co/spaces/Leon4gr45/UserSyncFrontend/resolve/main/node_modules/array-bounds/index.js
554 Bytes
| module.exports = normalize; | |
| function normalize (arr, dim) { | |
| if (!arr || arr.length == null) throw Error('Argument should be an array') | |
| if (dim == null) dim = 1 | |
| else dim = Math.floor(dim) | |
| var bounds = Array(dim * 2) | |
| for (var offset = 0; offset < dim; offset++) { | |
| var max = -Infinity, min = Infinity, i = offset, l = arr.length; | |
| for (; i < l; i+=dim) { | |
| if (arr[i] > max) max = arr[i]; | |
| if (arr[i] < min) min = arr[i]; | |
| } | |
| bounds[offset] = min | |
| bounds[dim + offset] = max | |
| } | |
| return bounds; | |
| } | |