mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-09-27 15:48:13 +08:00
* Disabled @blueprintjs/classes-constants. #2288. * thuang-eslint-bp-off (#2344) * Disabled @blueprintjs/classes-constants on webpack dev and shared. #2288. * Added TS recommended, suppress lint errors codemod. * Added per-error/warning ignore for tests. * Added per-error/warning ignore for configuration. * Added per-error/warning ignore for src. Removed suppress package. * Minor linting. Co-authored-by: Timmy Huang <tihuan@users.noreply.github.com>
35 lines
855 B
TypeScript
35 lines
855 B
TypeScript
/*
|
|
Return the [minimum, maximum] extent, of the given typed array, ignoring
|
|
non-finite values (ie, +Infinity, -Infinity).
|
|
|
|
If undefined or empty array, or array contains only non-finite numbers,
|
|
will return [undefined, undefined]
|
|
*/
|
|
|
|
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any -- - FIXME: disabled temporarily on migrate to TS.
|
|
function finiteExtent(tarr: any) {
|
|
let min;
|
|
let max;
|
|
let i;
|
|
|
|
for (i = 0; i < tarr.length; i += 1) {
|
|
const val = tarr[i];
|
|
if (Number.isFinite(val)) {
|
|
min = val;
|
|
max = val;
|
|
i += 1;
|
|
break;
|
|
}
|
|
}
|
|
for (; i < tarr.length; i += 1) {
|
|
const val = tarr[i];
|
|
if (Number.isFinite(val)) {
|
|
if (min > val) min = val;
|
|
if (max < val) max = val;
|
|
}
|
|
}
|
|
return [min, max];
|
|
}
|
|
|
|
export default finiteExtent;
|