| 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; | |
| } | |
Xet Storage Details
- Size:
- 554 Bytes
- Xet hash:
- 1ede6c6a22b3b0bbc54ab6cd96ff0612a3c3ac16b5929fafb9cfa1c2140ecc77
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.